Skip to content

Instantly share code, notes, and snippets.

@nakaji
Created February 22, 2012 11:32
Show Gist options
  • Save nakaji/1884379 to your computer and use it in GitHub Desktop.
Save nakaji/1884379 to your computer and use it in GitHub Desktop.
CTEで日付の一覧を作る
with l_date(salesdate) as (
select convert(datetime, '2012/02/01', 111)
union all
select dateadd(d, 1, salesdate)
from l_date
where salesdate <= convert(datetime, '2012/02/28', 111)
)
select * from l_date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment