如何选择多行填充常量? [英] How to select multiple rows filled with constants?

查看:155
本文介绍了如何选择多行填充常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不引用表的情况下选择常量在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆