I have this SQL statement where I'm trying to balance the allocation quantities between the ECL file and the ELA file. They are a one to many relationship. The problem is when the ECL.LQALL has a value > 0 and there are no ELA records this SQL statement doesn't catch the out of balance condition. How can I incorporate that condition into this SQL statement?

SELECT *
 FROM bpcsf/ecl,bpcsf/ech
WHERE lid ='CL'
  and lqall <> (SELECT sum(LQALL)
                  FROM bpcsf/ela
                 WHERE AORD = ecl.lord
                   and ALINE =ecl.lline
                   and ATYPE ='C')
  and lord = hord
  and hinuse <> 'Y'

Thank you for your assistance.

Regards,

Guy Henza
616 N Michigan Ave
Howell MI 48843
517.548.3563
guyhenza@xxxxxxxxxxx



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.