Re: Condition with more than one table

From: James O. Payne, Jr. <james_at_sugaree.uu.net>
Date: 21 May 92 20:41:53 GMT
Message-ID: <1992May21.164153.87_at_sugaree.uu.net>


In article <1992May20.104128.17408_at_nntp.hut.fi>, k33847k_at_taltta.hut.fi (Bahaaddin Ahrari) writes:
> SELECT Deposit.customer-name from Deposit,Borrow WHERE
> Deposit.customer-name=Borrow.customer-name AND Deposit.branch-name="Chicago"
> AND Borrow.brach-name="Chicago"
 

> Is the use of IN really necessary in SQL?

This is not a good example of the use of 'IN'... a better one would be if you wanted all customers with both types of records at a few different sites. For instance...

select DP.customer_name NAME

from   deposit            DP
,      borrow             BR
where  DP.customer_name = BR.customer_name 
and DP.branch_name = BR.branch_name and BR.branch_name in ('CHICAGO','MINNEAPOLIS','MILWAUKEE');

In this case, not using the 'IN' dealie would result in a much larger WHERE clause filled with parens and logical operators.

James O. Payne, Jr.                                                     
IKEA NA Information Systems                                             
Plymouth Meeting, PA 19462 USA                                215/834-0180 x343 
Received on Thu May 21 1992 - 22:41:53 CEST

Original text of this message