Re: Is there a difference between these SELECTS's?
Posted in 1997
belakimem@aol.com (Belakimem) wrote: :select * from A where A.numb in ( select numb from B ) : :select A.* from B,A where B.numb=A.numb I would have written: select A.* from A,B where A.numb=B.numb But it doesn't matter for the results. It's just a more logical way of describing what you are actually after. All of these selects should return the same rows even in the face of nulls in A.numb of B.numb. (In the result there will be no nulls in the numb column.) :Is one more efficient than the other? You can easily find out by running both and timing them. That's what we all do. You should also set explain on and look at the sqexplain.out file to see what the engine is doing. For even further analysis you could use the tools available (assuming you have some version of OnLine) to find the actual number of reads that are done. Often a join is faster than using in, but this use of in is normally also fast. :Please also reply by mail, thank you ! Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org