Advertisement
Sacsayhuaman

Untitled

Apr 6th, 2021
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   sql = "SELECT ad.USER_NO, SUBSTRING(usr.DIVISION,4,3) KST, adc.VALUE STD, ad.DAY, adc.CATEGORY_ID " & _
  2.         "FROM dbo.ANALYTICS_DAILY ad INNER JOIN " & _
  3.         "dbo.ANALYTICS_DAILY_CATEGORIES adc ON ad.ID = adc.ANALYTICS_DAILY_ID INNER JOIN " & _
  4.         "dbo.USERS usr ON ad.USER_NO = usr.NO " & _
  5.         "where ad.DAY >= Cast('" & Cells(3, cColJahr) & "-" & Format(Cells(3, cColMonat), "00") & "-01' as Datetime) and " & _
  6.         "ad.DAY < Cast('" & Cells(3, cColJahr) + IIf(Cells(3, cColMonat) = 12, 1, 0) & "-" & _
  7.         Format(IIf(Cells(3, cColMonat) + 1 > 12, 1, Cells(3, cColMonat) + 1), "00") & "-01' as Datetime) and " & _
  8.         "(adc.CATEGORY_ID=1 or adc.CATEGORY_ID=20 or adc.CATEGORY_ID=37) order by usr.DIVISION"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement