在SQL Server中,可以使用以下方法去重復行:
SELECT DISTINCT column1, column2, ...
FROM table_name;
SELECT column1, column2, ...
FROM table_name
GROUP BY column1, column2, ...;
WITH CTE AS (
SELECT column1, column2, ..., ROW_NUMBER() OVER (PARTITION BY column1, column2, ... ORDER BY column1) AS row_num
FROM table_name
)
SELECT column1, column2, ...
FROM CTE
WHERE row_num = 1;
注意:以上方法中的column1, column2, …表示要去重的列名,table_name表示要去重的表名。