Mysql:使用UNIONALL时,使用ORDERBY和limit进行单独查询

Mysql:使用UNIONALL时,使用ORDERBY和limit进行单独查询,mysql,sql,sql-order-by,limit,union-all,Mysql,Sql,Sql Order By,Limit,Union All,我知道MySql语法不允许我们做我正在寻找的事情,但我要求解决我的问题 我希望运行多个查询,并使用union通过使用每个查询的order by和limit来显示完整的数据集。由于法律问题,我使用了假参数和表名 select x, y, z from tbl1 where z = 'xxxx' and y = 111 and x = 'text' order by rand() limit 11966 union all select x, y,

我知道MySql语法不允许我们做我正在寻找的事情,但我要求解决我的问题

我希望运行多个查询,并使用union通过使用每个查询的order by和limit来显示完整的数据集。由于法律问题,我使用了假参数和表名

select 
    x,
    y,
    z
from tbl1
where z = 'xxxx'
and y = 111
and x = 'text'
order by rand()
limit 11966
union all
select 
    x,
    y,
    z
from tbl1
where z = 'xxxx'
and y = 222
and x = 'text'
order by rand()
limit 3560
union all
select
.
.
.
.
.
有人知道解决方法吗?

使用括号:

(select ... order by ... limit ...) 
union all
(select ... order by ... limit ...) 
union all
(select ... order by ... limit ...) 
union all
...