Boppity Bop
Boppity Bop

Reputation: 10483

SQLite (SQLiteStudio 3.3.3): select from hardcoded list of values

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

Upvotes: -1

Views: 503

Answers (1)

Boppity Bop
Boppity Bop

Reputation: 10483

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;

Upvotes: -1

Related Questions