它有很多具有NULL值的行,我使用以下查询删除了它:
/* DELETE EVERY ROW EXCEPT THE ROW WE NEED */
DELETE FROM [Database].[dbo].[Table]
WHERE
([Week Of*] IS NULL)
如何编写一个查询,该查询将从当前滚动周开始前12周并将[F4]
值插入表格
答案 0 :(得分:2)
SELECT f4
FROM yourtable
WHERE DATEADD(week, -12, [Week Of*]) >= 12
答案 1 :(得分:0)
我最后使用了以下这些给了我最近12周的时间(我怎么用14
来获得12周的时间。仍然试图找出原因:
SELECT CONVERT(VARCHAR(10),[Week Of*],110) AS [Date], [F18] AS [TOTALS] FROM [db].[DBO].[table] WHERE CONVERT(VARCHAR(10),[Week Of*],110) >= DATEADD(week, -14, GETDATE())