create table tmptable as select min(id) as tmp from target_table group by userId;
delete from target_table where id not in (select tmp from tmptable);
查询user_id数量大于1的数据信息
select *,count(user_id) from da_bank_base_user where is_valid = 1 group by user_id having count(user_id)>1;
本文介绍了一种使用SQL进行数据清理的方法,包括删除重复记录和查询特定条件下的数据信息。通过具体SQL语句示例展示了如何高效地完成这些任务。
8459

被折叠的 条评论
为什么被折叠?



