-1

I need to select few constants as if it was a table. I found similar question for postgress:

Select hardcoded values without table

But it doesnt work with SQLite. This:

select * from (
  values (1),(2),(3),(4),(5)
);

returns 1 5 times instead.

How do I fix it?

enter image description here

Boppity Bop
  • 9,613
  • 13
  • 72
  • 151
  • It works fine: https://dbfiddle.uk/?rdbms=sqlite_3.27&fiddle=b04a1d982fd76ef7c4869e1532c35f8d – forpas Jan 02 '22 at 15:40

1 Answers1

-1

It seems to be a bug. According to this it worked in previous version of sqlite: How do I name the output column in a sqlite values clause?

However this works as expected:

with cte(a) as (values (1),(2),(3),(4),(5))
  select * from cte;
Boppity Bop
  • 9,613
  • 13
  • 72
  • 151