【发布时间】:2020-08-03 06:21:28
【问题描述】:
我有一个包含以下字段的表格:
`contract`, `title`, `category`, `reglementation`, `company`, `role`, `start_date`, `end_date`, `creation_date`, `update_date`, `created_by`, `updated_by`,`context`,`hash`,`accept_schedule`,`need_timecard`
并且,我需要删除具有相同合同且 end_date 为 null 的行,但 start_date 的值较小
此查询返回重复行,它返回 9000
select contract, count(*)
from n_h_associate_occupation o
where end_date is null
group by o.contract
having count(*) > 1;
有没有办法删除这些行?请帮忙
【问题讨论】:
-
样本数据和期望的结果会有所帮助。
标签: java mysql sql duplicates row