delete from tmp_vloan_client_invitecode a where exists (
select 1 from (
select loginid,count(1) from tmp_vloan_client_invitecode group by loginid having count(1)>1
) b where a.loginid=b.loginid
) and a.name is null ;
解释:
delete from中 exist 和 and 和name is null 是属于同一级的筛选
理解为 删出 a.name is null的数据,其中又将loginid有多个的记录和 所有名字为空的loginid的数据 做匹配去删除 ,这么做的前提是_想删除的是loginid相同单但是名字为空的数据;