我列出了美国所有邮政编码。我需要删除不出现在多个县的邮政编码。
我创建了以下查询,它能够提取我不需要的所有邮政编码,但现在我需要删除它们。
SELECT zipcode, COUNT(countyname) FROM enrollmy_healthr.`table 10`
group by zipcode having count(zipcode)>1;
提前感谢您提供任何帮助。
此致
答案 0 :(得分:1)
这种方式可以帮到你
Delete from enrollmy_healthr.`table 10` where zipcode in
(select * from (SELECT e.zipcode FROM enrollmy_healthr.`table 10` e
group by e.zipcode having count(e.zipcode)>1) tmp )