欢迎投稿

今日深度:

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

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


有以下一个表

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

http://files.jb51.net/file_images/article/201606/201606081037581.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://files.jb51.net/file_images/article/201606/201606081037592.jpg

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

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

www.htsjk.Com true http://www.htsjk.com/Sql_Server/12024.html NewsArticle SQL中查找某几个字段完全一样的数据,sql中查找字段 有以下一个表 movestar(id,name,title,address),内容为: 现在要查找所有具有相同的title和address的人 复制代码 代码如下:select star1.name,st...
评论暂时关闭