MySQL版本:5.1.36
(select 1 as num) union ( (select 2 as num) union (select 3 as num))
以上查询会引发语法错误。
MySQL不支持联盟的嵌套? MySQL文档。对此保持沉默。
答案 0 :(得分:3)
我承认我从未尝试过嵌套UNION
,可能是因为以下查询是等效的并且可以接受:
(SELECT
1 AS num)
UNION
(SELECT
2 AS num)
UNION
(SELECT
3 AS num)