要从多个 select 语句中获取结果,请使用 UNION ALL。以下是语法 –
select yourValue1 AS anyColumnName UNION ALL select yourValue2 AS yourColumnName . . . . N
让我们实现上述语法,以返回不同行中的数字枚举 –
mysql> select 100 AS Number UNION ALL select 1000 AS Number UNION ALL select 10000 AS Number UNION ALL select 100000 AS Number UNION ALL select 1000000 AS Number UNION ALL select 10000000 AS Number UNION ALL select 100000000 AS Number UNION ALL select 1000000000 AS Number;
这将产生以下输出 –
+------------+ | Number | +------------+ | 100 | | 1000 | | 10000 | | 100000 | | 1000000 | | 10000000 | | 100000000 | | 1000000000 | +------------+ 8 rows in set (0.00 sec)原文来自:www.php.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容