您好,欢迎来到九壹网。
搜索
您的当前位置:首页SQL中查找某几个字段完全一样的数据

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

来源:九壹网


有以下一个表

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

现在要查找所有具有相同的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;

结果:

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

Copyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务