Hi Ann, it's allways a pleasure reading from you: there's anyway something to learn!
Ann Harrison <[email protected]> ha scritto: >> On Nov 29, 2013, at 12:10 PM, Umberto Masotti <[email protected]> wrote: >> >>> select id from TEST T where exists(select * from subquerytable sq >>> where sq.id2 = t.id2) >> >> That query seems logically equivalent to >> >> SELECT id FROM TEST T JOIN SUBQUERYTABLE SQ ON (T.id2=SQ.id2) > > The two queries are the same if there is at most one SQ.id2 for eacht T.id2. You are right, because I forgot to report clearly the limit of my statement relative to the context of the thread, where SUBQUERYTABLE.ID2 is a PK, so there are no chance to have more than one (and only one) distinct value for each ID2. I should have mentioned it for clarity; a PRIMARY KEY or an UNIQUE index on ID2 give the same result. Sorry for my insufficient comment. Have nice day. MM
