SQL How to create a list from Dual inside a WITH

1.6k views Asked by At

I don't want to create tmp tables. How to make this work?

with a as (
340401182,
340401183
)
select * from a
2

There are 2 answers

7
Chris Stewart On BEST ANSWER

If you want two rows and one column do this

with a as 
(
   Select 340401182 as val from dual
   UNION ALL
   Select 340401183 as val from dual
)
select * from a
0
Milney On

Very close....

with a as (
SELECT 
    340401182 AS Col1,
    340401183 as Col2
)
select * from a