网络编程
位置:首页>> 网络编程>> 数据库>> SQL中查找某几个字段完全一样的数据

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

作者:meaijojo  发布时间:2024-01-26 12:55:59 

标签:SQL,查找

有以下一个表

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中查找某几个字段完全一样的数据

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

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com