可能重複:
Delete duplicate records from a SQL table without a primary key重複刪除
我有數據:
SELECT
a
, b
FROM
(
select a = 1, b = 30
union all
select a = 2, b = 50
union all
select a = 3, b = 50
union all
select a = 4, b = 50
union all
select a = 5, b = 60
) t
我有一個)dublicate記錄,以獲取輸出(下一個(順序應從結果集中排除):
a b
----------- -----------
1 30
2 50
3 50 -- should be excluded
4 50 -- should be excluded
5 60
所以,問題是比'選擇分鐘(一)更加複雜,B 從... 組由B'? - 因爲這將與您的示例數據 – antlersoft
@antlersoft一起工作,這已經足夠了。我有:a是int並且b是唯一標識符,所以它也可以工作。謝謝。 – garik