Hi guys, I have this code where two columns are output, 1 column is 1-30 and the second occurs 30 days ago. today.
DECLARE @StartDate date SELECT @StartDate = GETDATE (); With CT AS (SELECT 1 AS idx, DATEADD (d, -1, StartDate) as idxDate UNION ALL SELECT idx - 1, DATEADD (d, -1, idxDate) with CTE WHERE idx & gt; -30) SELECT idx DateValue , CONVERT (VARCHAR (10), IDX date, 110) DateLabel CTE option (MAXRECURSION 0) to It seems that currently
Time date labels 1 06-20-2013 0 06-19-2013 -1 06-18-2013 -2 06-17-2013 etc. .. Therefore, instead of 1 and 0, there should be -1 and I want to add the deedviews behind Datelbell to look like this:
Date value dated B-1 06-20-2013, -1 -2 06-19-2013, -2 -3 06-18-2013, -3-4 06-17-2013, -4 Thanks in advance!
You mean by:
announcement @ date of the start date Select @startdate = GETDATE (); IDXD Union All Object Object-1, DataDad DDD (D-1, IDDX) as CTI AS (SATA-1As IDX, DATEADD (D, -1, ARTADET), CETE WHERE IDX & gt; -30) Sqd IDX date value , convert (VARCHAR (10), idxDate, 110) + ',' + (idx as nvarchar (max) +) DateLabel CTE Option (MAXRECURSION 0)
No comments:
Post a Comment