Re: Is there a difference between these SELECTS's?
Posted in 1997
Nils Myklebust wrote:
>
> 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
>
There is a difference. If there are duplicate numb rows in B that are
also in A, lets say 1 row in A that joins with 3 rows in B, then the
first select will only return 1 row whereas the second select will
return
3 rows. So it really depends on what you're after when you decide which
to use.
And I'm not sure why, but for the first select I've found sometimes its
faster to say:
select * from A where A.numb in (select unique numb from B)
Maybe because if theres alot of duplicates in B then it creates a
smaller
temp table?
Cheers,
Douglas Wilson
> 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.)