取一段连续时间
SELECT DISTINCT
CONVERT(VARCHAR(7), DATEADD(month, -number,
CONVERT(VARCHAR(11), GETDATE(), 120)), 120) AS NewDate
FROM master..spt_values
WHERE type = ‘p‘
AND number BETWEEN 0 AND 11
时间: 2024-11-08 13:31:22
取一段连续时间
SELECT DISTINCT
CONVERT(VARCHAR(7), DATEADD(month, -number,
CONVERT(VARCHAR(11), GETDATE(), 120)), 120) AS NewDate
FROM master..spt_values
WHERE type = ‘p‘
AND number BETWEEN 0 AND 11