我试着只保留ID只有一个销售日期的行,例如。
ID SALES_DTE
101 1月10日至12日
101 1月10日至12日
101 1月10日至12日
102 1月10日至12日
102 1月13日至12日
103 1月13日至12日
在上面,我想保留I 101和103,因为它们只有一个销售日期。但我不想要102,因为它有两个销售日期。有人能帮忙吗?
发布于 2012-10-29 23:50:00
delete from your_table
where id not in
(
select id
from your_table
group by id
having count(distinct sales_date) = 1
)https://stackoverflow.com/questions/13131288
复制相似问题