在一张表中过滤出同一张卡号对应多个户名数据

来源:互联网 发布:pta编程答案 编辑:程序博客网 时间:2024/06/05 06:02

今天突然发现一个貌似相仿的例子,在此记录。

select lxdh,kh,zhkhmc,khrzjhm from table 

where id = 666 and lxdh is not null

and lxdh in

(select lxdh from table where id = 666

and lxdh is not null and khrzjhm is not null

group by lxdh

having count(distinct khrzjhm)>=2)

阅读全文
0 0
原创粉丝点击