如何选择用常量填充的多行? [英] How to select multiple rows filled with constants?
本文介绍了如何选择用常量填充的多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 SQL 语句中选择常量而不引用表是完全合法的:
Selecting constants without referring to a table is perfectly legal in an SQL statement:
SELECT 1, 2, 3
后者返回的结果集是包含值的单行.我想知道是否有一种方法可以使用常量表达式一次选择多行,类似于:
The result set that the latter returns is a single row containing the values. I was wondering if there is a way to select multiple rows at once using a constant expression, something kind of:
SELECT ((1, 2, 3), (4, 5, 6), (7, 8, 9))
我想要类似上面的东西,它可以工作并返回一个包含 3 行和 3 列的结果集.
I would want something like the above that works and returns a result set with 3 rows and 3 columns.
推荐答案
SELECT 1, 2, 3
UNION ALL SELECT 4, 5, 6
UNION ALL SELECT 7, 8, 9
这篇关于如何选择用常量填充的多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文