既然是求交集,那么这两个表的关系模式应该是相同的了,
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来获取交集(交集肯定就是主键相等的了,因为关系模式相同)
mysql这垃圾不支持交集的。如果是数据库那么SQL如下SELECT id FROM a WHERE aid=5 INTERSECTSELECT id FROM a WHERE aid=6欢迎分享,转载请注明来源:内存溢出
评论列表(0条)