刪除表中多餘的重複記錄,重複記錄是根據單個字段(wm_classresid)來判斷,只留有wm_id最小的記錄ssr
DELETE FROM wm_classresourcesclass
WHERE wm_classresid IN (SELECT wm_classresid FROM (SELECT wm_classresid FROM wm_classresources GROUP BY wm_classresid HAVING COUNT(wm_classresid) > 1) a)
AND wm_id NOT IN ( SELECT wm_id FROM (SELECT MIN(wm_id) AS wm_id FROM wm_classresources GROUP BY wm_classresid HAVING COUNT(wm_classresid )>1) b)