当前位置: 代码迷 >> Sql Server >> 怎样找出 姓名相同,会员编号不同的顾客?解决方法
  详细解决方案

怎样找出 姓名相同,会员编号不同的顾客?解决方法

热度:3   发布时间:2016-04-27 13:24:48.0
怎样找出 姓名相同,会员编号不同的顾客?
姓名 name
会员编号 cli_no

------解决方案--------------------
SQL code
select *from tb twhere exists (select 1 from tb where name = t.name and id <> t.id)order by name
------解决方案--------------------
SQL code
select * from tb t where exists (select 1 from tb where name=t.name and cli_no<>t.cli_no)
------解决方案--------------------
探讨

SQL code

select *
from tb t
where exists (select 1 from tb where name = t.name and id <> t.id)
order by name

------解决方案--------------------

 select * from tab1 a
where exists (select 1 from tab1 where name=a.name and cli_no<>a.cli_no)
  相关解决方案