Having trouble with join

From: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>
To: reina(at)nsi(dot)edu, "pgsql-questions(at)postgresql(dot)org" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Having trouble with join
Date: 1998-09-25 00:49:41
Message-ID: 360AE8A5.15CDE741@nsi.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)nsi(dot)edu //
// //
///////////////////////////////////////////////////////

Browse pgsql-sql by date

  From Date Subject
Next Message James Olin Oden 1998-09-25 11:44:13 Re: [SQL] C compiler error when using PostGres
Previous Message G. Anthony Reina 1998-09-24 22:22:26 I can't seem to set the -B option on the postmaster over 3000