SQL中查找某几个字段完全一样的数据
时间:2022-06-03 11:08:19|栏目:MsSql|点击: 次
有以下一个表
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;
from movestar as star1,movestar as star2
where star1.title = star2.title
and star1.address = star2.address
and star1.name < star2.name;
结果:
要点:使用了<,假如用<>则会将内容重复列出
上一篇:sql server把退款总金额拆分到尽量少的多个订单中详解
栏 目:MsSql
下一篇:没有了
本文标题:SQL中查找某几个字段完全一样的数据
本文地址:http://www.codeinn.net/misctech/203589.html