问题是这样的:
有两张表:table 1 的结构:
id1 id2 1 1
1 2
3 4
6 9table 2的结构:
id1 id2
1 1
1 2
3 4
7 11
就是希望实现 oracle的 minus的效果:select * from table1
minus
select * from table2;
id1 id2
6 9mysql 要得到这种结果要怎么写才可以呢?
有两张表:table 1 的结构:
id1 id2 1 1
1 2
3 4
6 9table 2的结构:
id1 id2
1 1
1 2
3 4
7 11
就是希望实现 oracle的 minus的效果:select * from table1
minus
select * from table2;
id1 id2
6 9mysql 要得到这种结果要怎么写才可以呢?
解决方案 »
- (小菜请教)数据库连接生成并使用完以后,系统是如何销毁和回收资源的
- 求助啊,求助啊,update不能更新mediumtext 类型啊
- mysql 中 创建索引很慢,怎么解决
- mysql设置表A所有记录中,只能有一条记录valiad字段值为1
- MySql Control Center 连本地数据库出错
- 求关系模式中的主键和模式规范化程度以及模式的分解
- 用SQL实现对数据的字符替换,如何进行?
- 忘记MYSQL数据库密码怎么办
- 请问如何在插入一条记录后,取出其中自动生成的ID(AUTO_INCREMENT属性)
- 一条简单的SQL问题(关于查询)
- 为什么下面这个存储过程在mysql中运行后,会出现如下错误提示?怎样解决?
- mysql 存储过程游标的问题
where not exists (select 1 from table2 t2 where t1.id1 = t2.id1 and t1.id2 = t2.id2)如果id1本身就都是主键的话,可以
select * from table1 t1
where not exists (select 1 from table2 t2 where t1.id1 = t2.id1)
from tb1 A
where not exists (select 1 from tb2 id1=A.id1 and id2=A.id2)