答案 0 :(得分:0)
您可以使用left join和row_number窗口函数执行此操作。 在运行此查询之前,请检查列的正确性。
SELECT T2.[Operation cancelled within 28 days]
,T2.[Number of new patients seen]
,T2.[Number of follow up patients seen]
,T2.[Readmission Rate]
,T2.[2 Week Target]
,T1.[Procedure Split]
FROM
(SELECT DISTINCT [Operation cancelled within 28 days]
,[Procedure Split]
,ROW_NUMBER() OVER(ORDER BY NUM) AS RN FROM Your_table) T1
LEFT JOIN
(SELECT * FROM (SELECT DISTINCT [Operation cancelled within 28 days]
,[Number of new patients seen]
,[Number of follow up patients seen]
,[Readmission Rate]
,[2 Week Target]
,ROW_NUMBER() OVER(ORDER BY A) AS RN FROM Your_table) X
WHERE RN=1 ) T2
ON T1.RN = T2.RN