去掉交换重复的数据
时间:2011-10-14
来源:互联网
比如有两列
id1 id2
1 2
1 3
2 1
3 1
怎么得到
id1 id2
1 2
1 3
id1 id2
1 2
1 3
2 1
3 1
怎么得到
id1 id2
1 2
1 3
作者: tianzero 发布时间: 2011-10-14
详细说明,有重复取最小 ?
作者: WWWWA 发布时间: 2011-10-14
SQL code
select * from table1 a where not Exists (select 1 from table1 Where id1=a.id2 and id2=a.id1 and id1<id2)
作者: ACMAIN_CHM 发布时间: 2011-10-14
不知所云~~查询规则说下吗
作者: zhaoyun0209 发布时间: 2011-10-14
应该想表达 有2列,只有是相同的,不管是第1列在前 还是第2在前,只取一条
作者: tangyu477 发布时间: 2011-10-14
加入自增字段ID
select *
from ttj a
where not Exists (select 1 from ttj Where id1=a.id2 and id2=a.id1 and a.id>id)
select *
from ttj a
where not Exists (select 1 from ttj Where id1=a.id2 and id2=a.id1 and a.id>id)
作者: WWWWA 发布时间: 2011-10-14
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28