Hi,

I was wondering if anyone can help me with this syntax. I have three tables, INVOICES, CHECKS and CHECK_APPLICATIONS. I need to SUM the amounts in CHECK_APPLICATIONS for each invoice IF the check it is related to has not been voided. Something like this (in SQL and pseudocode)

SELECT invoices.id, invoices.vendor, invoices.namount AS nninvoiceamount, SUM(check_applications.namountapplied IF checks.lvoid=0)

I also need to refer to that SUM in another field.

invoices.namount - SUM(namountapplied we did before) AS namountleft

Any ideas?

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

  • SUMIF Menachem Bazian

Reply via email to