Skip to Content
0

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

Nov 20, 2017 at 07:29 AM

29

avatar image
Former Member

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;

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers