日期:2014-05-18 浏览次数:20568 次
SELECT Uid, SUM(Money), [如何造] FROM USER GROUP BY Uid 表中没有日期列,但是因为需要我想造个日期列,从2012-1-1开始到今天的日期,当然数量都是一样的,只要有日期列就OK
SELECT CONVERT(VARCHAR(10),DATEADD(DAY,number,'2012-01-01'),23) AS Date FROM master..spt_values WHERE type = 'P' AND DATEADD(DAY,number,'2012-01-01') <= GETDATE()