Date1
Date2Date3Date4Date5
以下是代表性数据的示例:
正如我在评论中提到的,使用计数来创建您的行,然后将JOIN
添加到它:
WITH N AS(
SELECT N
FROM (VALUES(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL))N(N)),
Tally AS(
SELECT TOP (SELECT MAX(Frequency) FROM dbo.YourTable)
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS I
FROM N N1, N N2) --100 rows, add more cross joins for more rows
SELECT YT.Duration,
YT.[Date]
FROM dbo.YourTable YT
JOIN Tally T ON YT.Frequency > T.I;