Search code examples
sqlwith-statementdual-table

SQL How to create a list from Dual inside a WITH


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

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

Solution

  • 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