Skip to Content
avatar image
Former Member

Below code works fine in SQL but how do i use the same to create a derived table in BO Universe.

DECLARE @StartDate datetime='2017-11-01'

DECLARE @EndDate datetime=SYSDATETIME()

;WITHdaysAS

(

SELECTDATEADD(DAY, n,DATEADD(DAY,DATEDIFF(DAY, 0, @StartDate), 0))as d

FROM (SELECTTOP (DATEDIFF(DAY, @StartDate, @EndDate)+ 1)

n =ROW_NUMBER()OVER (ORDERBY [object_id])- 1

FROMsys.all_objectsORDERBY [object_id] )AS n

)

selectdays.d,count(t.EXPECTEDDATE)

FROMdaysLEFTOUTERJOIN DEPOSIT as t

ON t.EXPECTEDDATE >=days.d AND t.EXPECTEDDATE <DATEADD(DAY, 1,days.d)

GROUPBYdays.d

ORDERBYdays.d;

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers