Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 434FE63225A for ; Mon, 22 Feb 2010 13:04:32 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 78472-07 for ; Mon, 22 Feb 2010 17:04:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by mail.postgresql.org (Postfix) with ESMTP id 50C4D6321DD for ; Mon, 22 Feb 2010 13:04:21 -0400 (AST) Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Njbhj-0002fv-NW; Mon, 22 Feb 2010 10:04:19 -0700 Received: from [208.187.158.94] (helo=[172.16.1.222]) by in02.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Njbhi-0007yw-4K; Mon, 22 Feb 2010 10:04:19 -0700 Message-ID: <4B82B960.3060901@gmail.com> Date: Mon, 22 Feb 2010 10:05:36 -0700 From: Rob Sargent User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 MIME-Version: 1.0 To: Gary Chambers CC: pgsql-sql@postgresql.org References: <302670f21002211525r65caee9et396c374a3cd64b0d@mail.gmail.com> <4B8211B2.6020406@gmail.com> <302670f21002220751h6cc363fiad449314d961fcc0@mail.gmail.com> In-Reply-To: <302670f21002220751h6cc363fiad449314d961fcc0@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-XM-SPF: eid=; ; ; mid=; ; ; hst=in02.mta.xmission.com; ; ; ip=208.187.158.94; ; ; frm=robjsargent@gmail.com; ; ; spf=neutral X-SA-Exim-Connect-IP: 208.187.158.94 X-SA-Exim-Mail-From: robjsargent@gmail.com X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Gary Chambers X-Spam-Relay-Country: Subject: Re: Join Advice and Assistance X-SA-Exim-Version: 4.2.1 (built Thu, 25 Oct 2007 00:26:12 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.575 tagged_above=-10 required=5 tests=AWL=-0.465, BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 201002/86 X-Sequence-Number: 33685 My mistake. Should answer these things late at night. I think you will find that arrays will be your friend[s] On 02/22/2010 08:51 AM, Gary Chambers wrote: > Rob, > > Thanks for the reply... > >> If you want records for user without email addresses you will need an outer >> join on user_emailaddrs >> >> /* untested */ >> select u.userId, u.lname, u.lastname ,m.startdate, a.emailaddr >> from users u >> join usermetas m on u.userid = m.userid >> left join user_emailaddrs a on m.userid = a.userid > > My question was related more toward eliminating the query returning a > record for each record in the one-to-many table. I see now that I'm > going to have to aggregate the e-mail addresses in order to return a > single row. Thanks again. > > -- Gary Chambers > > /* Nothing fancy and nothing Microsoft! */