列表到列 sql

a list into a column sql

我有几件商品 item1 item2 item3 item4.. item10

我想在 sql 中查看,我将它们放在一个列中

Items
------
item1
item2
item3
item4
....
....
....
item10

如有任何建议,我们将不胜感激!以下是我尝试过的

select case when item1 in item1 then item1
when item2 in item2 then item2
end as Items
from dummy

没用

我想你是说你想创建一个 table 而不是创建一个你可以从具有一些预定义值的视图调用的 table...让我知道这是否正确.没有写入权限似乎是一种奇怪的解决方法。

虚拟视图:

SELECT 'Item01' AS 'Items'
UNION
SELECT 'Item02'
UNION
SELECT 'Item03'
UNION
SELECT 'Item04'
UNION
SELECT 'Item05'
UNION
SELECT 'Item06'
UNION
SELECT 'Item07'
UNION
SELECT 'Item08'
UNION
SELECT 'Item09'
UNION
SELECT 'Item10'

不确定这是否可行,或者是否是您想要的。