既然是求交集,那么这两个表的关系模式应该是相同的了,
select
a.*
from
(select
*
from
table
order
by
table.a
desc
limit
10)
as
a,
(select
*
from
table
order
by
table.b
desc
limit
10)
as
b
where
a.primary_key
=
b.primary_key
--先将两个结果作为两张临时表,然后通过主键
primary_key来获取交集(交集肯定就是主键相等的了,因为关系模式相同)
查询1:select * form A where keywords like '%小猫%'
查询2:
select * form A where keywords like '%小狗%'
select * from 查询1 a inenr join 查询2 on a.keywords=b.keywords
SELECT * FROM 表名 WHERE stu_nianji like "2010%" and stu_banji like "信管%"是这个意思吗?多个条件取交集用AND,取并集用OR,可以举一反三,祝你好运。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)