我正在尝试根据表中的一列中的值生成多行。我需要行数是列中数据值的三倍。目前我有它,所以它根据列中的值重复行数,但我不知道如何让它产生列中值的三倍。这是我的代码:
WITH tmp as (SELECT 1 as rn UNION ALL SELECT rn+1 from tmp WHERE rn<=1000)
SELECT
[SURNAME],
[NAME],
[AGE],
[PAYMENT DAYS PER/WK]
FROM
[PublishedReporting].[dbo].[Sheet1$]
LEFT JOIN (SELECT * FROM tmp WHERE rn<=50) as
rowgen on [PAYMENT DAYS PER/WK] >= rowgen.rn
WHERE
[PAYMENT DAYS PER/WK] IS NOT NULL
ORDER BY
SURNAME,
NAME
option (maxrecursion 32767);
这是我的结果示例:所以这里显示了露西亚当斯的 3 行,但我需要它显示 9
谢谢