Select hardcoded values without table
PostgresqlPostgresql Problem Overview
I need to run a select without actually connecting to any table. I just have a predefined hardcoded set of values I need to loop over:
foo
bar
fooBar
And I want to loop through those values. I can do:
select 'foo', 'bar', 'fooBar';
But this returns it as one row:
?column? | ?column? | ?column?
----------+----------+----------
foo | bar | fooBar
(1 row)
I am using Postgresql.
Postgresql Solutions
Solution 1 - Postgresql
select a
from (
values ('foo'), ('bar'), ('fooBar')
) s(a);
http://www.postgresql.org/docs/current/static/queries-values.html