sveer
sveer

Reputation: 472

a list into a column sql

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

Upvotes: 0

Views: 105

Answers (1)

justiceorjustus
justiceorjustus

Reputation: 1965

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.

Upvotes: 1

Related Questions