当前位置: 移动技术网 > IT编程>数据库>MSSQL > SQL中查找某几个字段完全一样的数据

SQL中查找某几个字段完全一样的数据

2017年12月08日  | 移动技术网IT编程  | 我要评论

郑铃丹,雪菲胶囊,京v牌照

有以下一个表

movestar(id,name,title,address),内容为:

http://www.lhsxpumps.com/_images/10qianwan/20171208/b_1_201712081851421544.jpg

现在要查找所有具有相同的title和address的人

复制代码 代码如下:
select star1.name,star2.name,star1.title,star1.address
from movestar as star1,movestar as star2
where star1.title = star2.title
    and star1.address = star2.address
    and star1.name < star2.name;

结果:

http://www.lhsxpumps.com/_images/10qianwan/20171208/b_1_201712081851421073.jpg

要点:使用了<,假如用<>则会将内容重复列出

以上就是sql中查找某几个字段完全一样的数据的全部内容,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网