首页 > 数据库 > SQL Server > 正文

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

2024-08-31 01:03:56
字体:
来源:转载
供稿:网友

有以下一个表

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

SQL,查找,相同

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

 

结果:

SQL,查找,相同

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

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


注:相关教程知识阅读请移步到MSSQL教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表