with temp as( SELECT *, ROW_NUMBER() over(order by [欄位名稱]) as rnk FROM [表格名稱] ) DELETE temp where rnk NOT IN (Select Max(rnk) From temp Group By [欄位名稱])
如果沒有pk,就用row_number給流水號
不挑戰記憶力的技術筆記
with temp as( SELECT *, ROW_NUMBER() over(order by [欄位名稱]) as rnk FROM [表格名稱] ) DELETE temp where rnk NOT IN (Select Max(rnk) From temp Group By [欄位名稱])
如果沒有pk,就用row_number給流水號