[SQL]重覆資料查詢
--找出重覆的資料 SELECT img,COUNT(*)/*重複的次數*/ FROM LiteratureWorkImg where img like '/2 藝術家作品與計畫/1)(歷屆)藝術%' GROUP BY img HAVING COUNT(*) > 1 DELETE FROM myTable WHERE ID NOT IN ( SELECT MIN ( ID ) FROM myTable GROUP BY duplicate_field1 , duplicate_field2 ... ) 如果資料表沒有主鍵(without primary key): SELECT DISTINCT * INTO # TEMP FROM myTable TRUNCATE TABLE myTable INSERT INTO myTable SELECT * FROM # TEMP