Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想做两个 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
它不允许我这样做。
其实我想我现在已经解决了这个问题。我实际上并不知道这个网站是如何工作的,但我已经通过这样做:
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 )