Re: joining an array with a table or...?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: joining an array with a table or...?
Date: 2009-10-26 18:56:26
Message-ID: b42b73150910261156j40443cccha8a2b6fe9929eb00@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 26, 2009 at 11:05 AM, Ivan Sergio Borgonovo
<mail(at)webthatworks(dot)it> wrote:
> To make it more concrete I came up with:
>
> select coalesce(u.mail,j.mail) from (
>  select (array['m(at)example1(dot)com','m(at)example2(dot)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(at)example1(dot)com'), ('m(at)example2(dot)com')
) j(mail)
left join users u on upper(u.mail)=upper(j.mail);

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Timothy Madden 2009-10-26 19:03:40 Re: Can the string literal syntax for function definitions please be dropped ?
Previous Message Joshua D. Drake 2009-10-26 18:47:48 Re: Why does pg_dump set default_with_oids to true?