【发布时间】:2019-03-22 09:55:51
【问题描述】:
我正在尝试执行一个查询,将文字值列表转换为结果集,但如果不进行联合,我无法完全弄清楚语法。
以下是我尝试过的几件事:
SELECT *
FROM (1, 2, 3, 5, 6) temp(id);
select x.* from
(('test-a1', 'test-a2'), ('test-b1', 'test-b2'), ('test-c1', 'test-c2')) x(col1, col2);
我期望的结果集如下所示:
id
1
2
3
4
5
etc…
或
col1 | col2
test-a1, test-a2
test-b1, test-b2
test-c1, test-c2
etc…
【问题讨论】: