Re: joining an array with a table or...? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: joining an array with a table or...?
Date
Msg-id b42b73150910261156j40443cccha8a2b6fe9929eb00@mail.gmail.com
Whole thread Raw
In response to Re: joining an array with a table or...?  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: joining an array with a table or...?
List pgsql-general
On Mon, Oct 26, 2009 at 11:05 AM, Ivan Sergio Borgonovo
<mail@webthatworks.it> wrote:
> To make it more concrete I came up with:
>
> select coalesce(u.mail,j.mail) from (
>  select (array['m@example1.com','m@example2.com'])[i] as mail
>   from generate_series(1,2) i) j
>   left join users u on upper(u.mail)=upper(j.mail);

how about this:
select coalesce(u.mail,j.mail) from
(
 values ('m@example1.com'), ('m@example2.com')
) j(mail)
 left join users u on upper(u.mail)=upper(j.mail);

merlin

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Why does pg_dump set default_with_oids to true?
Next
From: Timothy Madden
Date:
Subject: Re: Can the string literal syntax for function definitions please be dropped ?