时间:2021-07-01 10:21:17 帮助过:39人阅读
--查出二码,归档日期,借据号重复的数据的条数
select default_index_item_id,record_date,index_yxdk_dkjjh,min(sys_org_id),max(sys_org_id), min(submit_time),max(submit_time),count(index_yxdk_id),
min(index_yxdk_id),max(index_yxdk_id)
from index_yxdk_tb
group by default_index_item_id,record_date,index_yxdk_dkjjh
having count(index_yxdk_id) > 1
--查看最小ID
select min(index_yxdk_id)
from index_yxdk_tb
group by default_index_item_id,record_date,index_yxdk_dkjjh
having count(index_yxdk_id) > 1
--删除最小的ID
delete from index_yxdk_tb where index_yxdk_id in (
select min(index_yxdk_id)
from index_yxdk_tb
group by default_index_item_id,record_date,index_yxdk_dkjjh
having count(index_yxdk_id) > 1
)
db2记录去重
标签:sel let having item date 日期 dex select sys