|
Bruce, I love listening to this part of the SQL story. Lest you think I'm a complete anti-SQL fanatic, I think this is actually an excellent use of SQL. It could be done in RPG, but here I think the SQL statement is every bit as readable, and is probably faster. > select * from sofile s > join acctfile on soact = acctact a > join codefile c on s.sostat = c.stat and a.acctstat = c.acctstat and > s.sotype = c.sotype A couple of quick questions on this just to show my SQL ignorance: do the acctfile join and codefile join act in tandem (ANDed) or separately (ORed)? I ask because you said breaking up the code portion would cause it to be ORed. I'm wondering why. Is the above statement ANDed because a field from acctfile is used in the join to codefile? Second, could multiple type files could be handled like this: select * from sofile s join acctfile on soact = acctact a where s.sostat in (select x.sostat from SOSTATS x) and a.acctstat in (select y.acctstat from ACCTSTATS y) and s.sotype in (select z.sotype from SOTYPES z) Am I somewhere in the ballpark here? Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.