0
votes

I have few items item1 item2 item3 item4.. item10

I would like to have a view in sql where I have them in a column

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

any suggestions would be appreciated! the below what i have tried

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

it didn't work

1
which database are you using ? - Sudipta Mondal
@SudiptaMondal SAP hana! - sveer
Can you be more clear in what you are asking for and what tables you are working with? - justiceorjustus
there are no tables and i dont have rights to write my own table, but i can right views in my schema. I want to have a table with few items in a columns which i know. so i would like to create a view where i can call the list of items a s coulmn table. is it more clear? - sveer

1 Answers

1
votes

I think you're saying you want to create a table without creating a table which you can call from a view that has some predefined values... let me know if that's correct. It seems like a weird workaround to not having write access.

Dummy View:

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'

Not sure if this will work or if it's what you wanted.