这个查询的输出是什么?

时间:2013-03-06 19:50:24

标签: sql-server sql-server-2008

SELECT '(Current Week)'
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -7, GetDate()), default), 101)
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -14, GetDate()), default), 101)
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -21, GetDate()), default), 101)
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -28, GetDate()), default), 101)
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -35, GetDate()), default), 101)
UNION SELECT Convert(varchar, dbo.firstOfWeek(DateAdd(dd, -42, GetDate()), default), 101)
order by 1

1 个答案:

答案 0 :(得分:0)

我认为你的意思是:

SELECT '(Current Week)'
UNION SELECT Convert(varchar, DateAdd(dd, -7, GetDate()), 101)
UNION SELECT Convert(varchar, DateAdd(dd, -14, GetDate()), 101)
UNION SELECT Convert(varchar, DateAdd(dd, -21, GetDate()), 101)
UNION SELECT Convert(varchar, DateAdd(dd, -28, GetDate()), 101)
UNION SELECT Convert(varchar, DateAdd(dd, -35, GetDate()), 101)
UNION SELECT Convert(varchar, DateAdd(dd, -42, GetDate()), 101)
order by 1

(Current Week)
01/23/2013
01/30/2013
02/06/2013
02/13/2013
02/20/2013
02/27/2013