我想选择具有表中已存在的值的所有行.我找不到更好的解决方案
select * from provisioning_requests tt where code in (select code from provisioning_requests tt2 where tt2.id <> tt.id)
这似乎有点幼稚.有人有更好的解决方案吗?
解决方法
select * from provisioning_requests t1 join (select code from provisioning_requests group by code having count(*)>1) t2 ON t1.code = t2.code
要么
select * from provisioning_requests WHERE code in (select code from provisioning_requests group by code having count(*)>1)