我有一张桌子
Id int
Post code int
Suburb varchar
State varchar
我需要能够找到合并的(post code, suburb, state)
将它们插入到一个记录错误数据的绝望表中
Eg
Id int
Post code int
Suburb varchar
State varchar
答案 0 :(得分:2)
INSERT INTO IncorrectResults (PostCode, Suburb, State)
SELECT PostCode, Suburb, State
FROM MyTable
GROUP BY PostCode, Suburb, State
HAVING COUNT(*) > 1