assistance rewriting query for mysql

ivan ivan at 420.am
Sun Jul 7 18:41:03 PDT 2002


This is the last known bug remaining for 1.4.0.

Can someone rewrite this query for MySQL?  See
http://pouncequick.420.am/rt/Ticket/Display.html?id=300 for an example of
similar rewrites to work around the lack of subqueries. 

SELECT * FROM cust_bill
WHERE 0 != charged - ( select coalesce(sum(amount),0) from cust_bill_pay
                       where cust_bill_pay.invnum = cust_bill.invnum )
                   - ( select coalesce(sum(amount),0) from cust_credit_bill
                       where cust_credit_bill.invnum = cust_bill.invnum )

-- 
_ivan



More information about the freeside-devel mailing list