日期:2014-05-16 浏览次数:20427 次
SELECT * FROM result a WHERE (a.name, a.course) IN(SELECT b.name, b.course FROM result b GROUP BY b.name, b.course HAVING COUNT(*) > 1)
SELECT * FROM result a WHERE EXISTS (SELECT 1 FROM result b WHERE a.name=b.name AND a.course=b.course AND a.id > b.id)
DELETE FROM result a WHERE EXISTS (SELECT 1 FROM result b WHERE a.name=b.name AND a.course=b.course AND a.id > b.id)
CREATE TABLE #tmp AS SELECT DISTINCT * FROM result; TRUNCATE TABLE result; INSERT INTO result SELECT * FROM #tmp;
SELECT * FROM result a WHERE a.ROWID > (SELECT MIN(ROWID) FROM result b WHERE a.id=b.id AND a.name=b.name AND a.course=b.course)
DELETE FROM result a WHERE a.ROWID > (SELECT MIN(ROWID) FROM result b WHERE a.id=b.id AND a.name=b.name AND a.course=b.course)