1

我想做两个 SQL 查询并获得每个查询返回的随机结果,然后将它们合并在一起,有点像这样:

select colA, colB, colC
from tableA
order by random() limit 10

union all

select colA, colB, colC
from tableB
order by random() limit 10

它不允许我这样做。

4

1 回答 1

4

其实我想我现在已经解决了这个问题。我实际上并不知道这个网站是如何工作的,但我已经通过这样做:

select * from ( 
   select colA, colB, colC 
   from tableA 
   order by random() limit 10 
) 
union all 

select * from ( 
   select colA, colB, colC 
   from tableB 
   order by random() limit 10 
)
于 2013-06-18T08:09:50.870 回答