Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. CKG Edit ====== ====== ===== Explanation of SQL ===== Use this query to find orders with negative balance due. This is usually due to a bug whereby payments could be doubled (really entered twice without refreshing) or even tripled. This query finds those affected orders. ===== Risk of Data Corruption if Run Improperly ===== **None**. This is a selection query and no data is modified in the running of it. ===== SQL ===== <code sql> select OrderNumber, TotalPrice, PaymentTotal, CreditMemoAmount, BalanceDue, StatusText, OrderCreatedDate, SaleDate, (Select SUM(Amount) from GL where TransactionID = TransHeader.ID and GLAccountID = 14) as ARBalance, from TransHeader where BalanceDue < 0 and TransactionType = 1 order by OrderNumber desc </code> ===== Version Information ===== * Entered : 3/2012 * Version : 4.6+