如果用地址判断是否重复数据还可以, 用 select id,name,address from temp where address in (select address from temp group by address having count(*)>1)如果用 name 的话 基本上做不了,一条条 自己找呗^_^
select id,name,address from temp where address in (select address from temp group by address having count(*)>1) or name in (select name from temp group by name having count(*)>1)看看是不是你想要的结果啊
select customerid,iismain from mp_contact where iismain='1' group by customerid having count(*)>1如果返回数据为空,则数据库中一个客户没有多个主联系人。 如果返回数据不为空,则数据库中一个客户有多个主联系人。
用游标吧 用个循环,使用ascii(substr())比较记录间字符的异同, 再记数,如果相同的字符数与两条记录字符数较少的那个的字符数差在一半以内,就认为是重复的.e.g.; 有a,b两条记录.a的字符数为m,b的字符数为n,通过ascii码比较两记录间相同字符数为p,且m<n. if |p-m| <= m/2, then a,b是重复的记录(|p-m|指取p,m之差的绝对值). 以上算法请楼主参考.
用 select id,name,address
from temp
where address
in (select address from temp group by address having count(*)>1)如果用 name 的话 基本上做不了,一条条 自己找呗^_^
from temp
where address
in (select address from temp group by address having count(*)>1) or name in (select name from temp group by name having count(*)>1)看看是不是你想要的结果啊
5楼 pcziyan() 的答案问题也一样,所以不行,不过还是要多谢二位
http://www.woyaola.net/shujuku/12581.html
group by customerid having count(*)>1如果返回数据为空,则数据库中一个客户没有多个主联系人。
如果返回数据不为空,则数据库中一个客户有多个主联系人。
用个循环,使用ascii(substr())比较记录间字符的异同,
再记数,如果相同的字符数与两条记录字符数较少的那个的字符数差在一半以内,就认为是重复的.e.g.;
有a,b两条记录.a的字符数为m,b的字符数为n,通过ascii码比较两记录间相同字符数为p,且m<n.
if |p-m| <= m/2, then a,b是重复的记录(|p-m|指取p,m之差的绝对值).
以上算法请楼主参考.