Having trouble with join
От | G. Anthony Reina |
---|---|
Тема | Having trouble with join |
Дата | |
Msg-id | 360AE8A5.15CDE741@nsi.edu обсуждение исходный текст |
Список | 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@nsi.edu // // // ///////////////////////////////////////////////////////
В списке pgsql-sql по дате отправления: