Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select list of VALUES in redshift?

The following query works in Postgresql but not in Redshift:

WITH bar (baz) AS
    (VALUES ('a'), ('b'), ('c'))
SELECT * from bar;

Which gives

baz
---
a
b
c

How can I replicate this behaviour in Redshift?

like image 473
drum Avatar asked Sep 20 '19 14:09

drum


1 Answers

unfortunately UNION is the only way here:

WITH bar (baz) AS
(select 'a' union select 'b' union select 'c')
SELECT * from bar;
like image 112
AlexYes Avatar answered Nov 01 '22 14:11

AlexYes