表T中有兩個數值字段m和n,如果某條記錄m值與另一條記錄的n值相等,具n值等於另一條記錄的m值,則認為這兩條記錄是同一條重複的記錄. 舉例,比如1和2,与2和1, 算是重複的.現在要篩選出不重複的記錄, 請問sql語句怎麼寫?
解决方案 »
- 在Report Services 中能显示出条形码么?
- 推荐:好的数据库方面的书
- 困惑已久的tsql疑问:能不能一条语句完成这个功能?
- 学生成绩按次数分组求合
- 急求关于取值的解决办法,在线等,回答正确,立刻结贴!!
- 比如有个字段要求插入这样格式的数据UReq201209240001,UReq201209240002,oracle容易实现,sqlserver怎么实现呢
- 各位高手,VB中如何实现用命令恢复SQLServer 备份啊
- sql2000数据库能不能向外部发送消息?比如当插入一条信息就向VC编写的界面发送记录的总条数。
- 很莫名的网站访问慢的问题,跪求帮助
- 一个循环查询的存储过程问题
- 上次试验了还是不行,这次再求解,这个问题真的很复杂!!!
- 查询比平均工资最低的那个部门的最高工资 高 的所有职工
from tb A
where not exists (select 1 from tb B where A.m=B.n and A.m=B.m)
insert into tb values(1 , 2)
insert into tb values(2 , 1)
insert into tb values(1 , 3)
insert into tb values(3 , 1)
insert into tb values(1 , 4)
go
select a.* from tb a where not exists(select 1 from tb b where a.m = b.n and a.n = b.m)
drop table tb/*
m n
----------- -----------
1 4(所影响的行数为 1 行)
*/