Re: Join Advice and Assistance

From: Gary Chambers <gwchamb(at)gmail(dot)com>
To: Stephen Belcher <sycobuny(at)malkier(dot)net>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Join Advice and Assistance
Date: 2010-02-22 22:43:22
Message-ID: 302670f21002221443r4ab62e4dk2bc61f4fa55f9a48@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephen,

> If you want to return a single row for each user, regardless of the number
> of email addresses, you might use ARRAY() with a subquery, eg (haven't
> tested this to make sure it completely works):

Your query worked perfectly!

> Of course, this will return the addresses as a character varying[], with
> output like {user(at)domain(dot)tld,user(at)domain(dot)tld}, and would require some minor
> contortions to present it to users cleanly. The array_to_string function may
> help you make it easier to display the results.

Absolutely -- and thank you for the suggestion. I'll be retrieving
the results of the query through PHP, so cleanup in the query may even
be a performance degradation.

> Hope this helps,

You and Rob Sargent have helped a great deal. Thanks to both of you.

-- Gary Chambers

/* Nothing fancy and nothing Microsoft! */

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Louis-David Mitterrand 2010-02-24 12:40:23 join with an array
Previous Message Stephen Belcher 2010-02-22 17:15:06 Re: Join Advice and Assistance