Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4BE89634A87 for ; Mon, 22 Feb 2010 12:43:16 -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 72918-02 for ; Mon, 22 Feb 2010 16:43:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f202.google.com (mail-qy0-f202.google.com [209.85.221.202]) by mail.postgresql.org (Postfix) with ESMTP id 297C86354CB for ; Mon, 22 Feb 2010 11:51:09 -0400 (AST) Received: by qyk40 with SMTP id 40so1927980qyk.24 for ; Mon, 22 Feb 2010 07:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=pz5+RmlHi9Y6FxqDl/PAabVMvnNJjVQ7cv9LAxVEG0s=; b=GdaBY6xxzeOojdBj2wEdgMSVpQrK7u6YRqiWpQdzL6uNPa6ZDx2aBwG83uwK+RwAF9 6tP23TyE3C43UxrJJObWFmHoF/r4xK85Z5wE1pLZxFwhGT+PN6qlGUfABxC6VmizXLgj ZUeklW9Wx1UZBNZ6zLhucDlRYT7rKOOK9kVKc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=WxSc/ylzDQes0VNTmuBU/XdorE3qMeY+Ua+4h0vuq0228U8hr5GNPMI0DRQQgf8ScN n26nqqs9gWc2f9rh6k5Oq8WyXy8LzHVz5/HKnxZcYKpVhiny5zgRjcVjX03rMiXEVR4z ema2szkFgLz32Cz+6g+EZqhltnGIAW4kvw7kQ= MIME-Version: 1.0 Received: by 10.229.227.83 with SMTP id iz19mr73984qcb.44.1266853867269; Mon, 22 Feb 2010 07:51:07 -0800 (PST) In-Reply-To: <4B8211B2.6020406@gmail.com> References: <302670f21002211525r65caee9et396c374a3cd64b0d@mail.gmail.com> <4B8211B2.6020406@gmail.com> Date: Mon, 22 Feb 2010 10:51:07 -0500 Message-ID: <302670f21002220751h6cc363fiad449314d961fcc0@mail.gmail.com> Subject: Re: Join Advice and Assistance From: Gary Chambers To: Rob Sargent Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.392 tagged_above=-10 required=5 tests=AWL=1.207, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/85 X-Sequence-Number: 33684 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! */