Differences
This shows you the differences between two versions of the page.
control_sql_-_customer_credit_balance_integrity_check [2019/01/27 11:28] 127.0.0.1 external edit |
control_sql_-_customer_credit_balance_integrity_check [2019/02/05 11:28] admin |
||
---|---|---|---|
Line 22: | Line 22: | ||
<code sql> | <code sql> | ||
- | select | + | SELECT |
- | (select | + | (SELECT |
- | | + | |
- | | + | |
- | (select | + | (SELECT |
- | | + | |
- | | + | |
GLAmount AS GLCreditBalance, | GLAmount AS GLCreditBalance, | ||
- | B.CreditBalance | + | B.CreditBalance |
- | | + | |
- | | + | |
- | (select max(EntryDateTime) | + | (SELECT MAX(EntryDateTime) |
- | | + | |
- | | + | |
- | | + | |
- | from | + | |
+ | FROM | ||
( | ( | ||
- | | + | |
- | AccountID | + | AccountID |
- | -sum(Amount) | + | -SUM(Amount) |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | ) as A | + | ) AS A |
- | full join | + | FULL JOIN |
( | ( | ||
- | | + | |
- | coalesce(DivisionID, | + | COALESCE(DivisionID, |
- | | + | |
- | | + | |
- | ) as B on A.GLsAccountID = B.AccountID | + | ) AS B ON A.GLsAccountID = B.AccountID |
- | where coalesce(A.GLAmount, | + | |
- | order by Division, CompanyName, | + | WHERE COALESCE(A.GLAmount, |
+ | |||
+ | ORDER BY Division, CompanyName, | ||
</ | </ | ||