Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id BA92B9FB7EF for ; Fri, 27 Jul 2007 12:44:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 22464-02 for ; Fri, 27 Jul 2007 12:44:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from smtp107.mail.mud.yahoo.com (smtp107.mail.mud.yahoo.com [209.191.85.217]) by postgresql.org (Postfix) with SMTP id 1F3049FB30D for ; Fri, 27 Jul 2007 12:44:18 -0300 (ADT) Received: (qmail 59555 invoked from network); 27 Jul 2007 15:44:18 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Received:X-YMail-OSG:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=CUdDME49eEQsrQLSTd5umckSiz93GpOhMwpcHx2EHbxCnfPSVitbI//iDVom3x6Iwtkre0iwtH53MOVt2Vspkt/EZdP3rxhN1JKsaqO/9XCYEplDFi/gDmnFDdu9qSb3Kjf/e1zg/Wlw1yIbpP4Txe5jB7AkwbcaryY8ZjcSw+c= ; Received: from unknown (HELO ?10.2.200.151?) (osvaldo_kussama@189.25.17.212 with plain) by smtp107.mail.mud.yahoo.com with SMTP; 27 Jul 2007 15:44:17 -0000 X-YMail-OSG: qwiJVhkVM1lJ93gL7L8XwL_KO3VGIk6lncSXvAEOAkGt7ucE Message-ID: <46AA138D.3070601@yahoo.com.br> Date: Fri, 27 Jul 2007 12:47:25 -0300 From: Osvaldo Rosario Kussama User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: chester c young CC: sql pgsql Subject: Re: problem join References: <820562.64742.qm@web54307.mail.re2.yahoo.com> In-Reply-To: <820562.64742.qm@web54307.mail.re2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200707/169 X-Sequence-Number: 28904 chester c young escreveu: > having problem joining these correctly: > > schedule > - cal_id references calendar not null > - usr_id references users not null > = unique( calZ_id, usr_id ) > - result_no not null > > activity > - cal_id references calendar not null > - usr_id references users not null > = unique( cal_id, usr_id ) > - from_ts timestamp not null > > trying to join > - cal_id > - usr_id > - schedule.result_no (might be null) > - activity.from_ts (might be null) > where schedule.usr_id = activity.usr_id would result in one row > Try: SELECT * FROM schedule FULL OUTER JOIN activity USING (cal_id, usr_id) .... Osvaldo