Received: from nsi.edu (amethea.nsi.edu [198.133.185.9]) by hub.org (8.8.8/8.8.8) with ESMTP id UAA20727 for ; Thu, 24 Sep 1998 20:48:13 -0400 (EDT) (envelope-from reina@nsi.edu) Received: from nsi.edu (IDENT:reina@bigred.nsi.edu [204.128.156.214]) by nsi.edu (8.9.1/8.9.1) with ESMTP id RAA07877; Thu, 24 Sep 1998 17:48:06 -0700 (PDT) Sender: reina@nsi.edu Message-ID: <360AE8A5.15CDE741@nsi.edu> Date: Thu, 24 Sep 1998 17:49:41 -0700 From: "G. Anthony Reina" Organization: The Neurosciences Institute X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.34 i686) MIME-Version: 1.0 To: reina@nsi.edu, "pgsql-questions@postgresql.org" Subject: Having trouble with join Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I have a subquery that I'd like to make a join instead to see if it is any faster. subquery: select distinct cell from center_out_cell where rep in (select rep from center_out_opto where marker = 5); All this does is find the occurrences of 'cell' that have 'marker' = 5. However, 'cell' is defined in table center_out_cell and 'marker' is defined in table 'center_out_opto'. Both tables have 'rep' so that ties them together. The subquery gives me the correct results. I tried this for a join but didn't get the right result: select distinct cc.cell from center_out_cell cc, center_out_opto co where co.marker = 5 and co.rep = cc.rep; Can anyone tell me what I'm doing wrong? Does this sound more like a subquery or a join? Thanks -Tony -- ( @@ ) ////////////////////oOO*(__)*OOo/////////////////////// // // // G. Anthony Reina, MD // // The Neurosciences Institute // // 10640 John Jay Hopkins Drive // // San Diego, CA 92121 USA // // // // Voice: (619) 626-2000 FAX: (619) 626-2199 // // E-mail: reina@nsi.edu // // // ///////////////////////////////////////////////////////