Over a million developers have joined DZone.

Weird Sql Query

·
// description of your code here


select convert(varchar(8),dateadd(dd , i.i * -1, dte.d ),112)
from 
(select 0 AS I union all 
select 1 union 
select 2 union 
select 3 union 
select 4 union 
select 5 union 
select 6
) i
CROSS join 
(select dateadd(dd,0,getdate()) AS D) dte
order by dte.d desc
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}