Differences
This shows you the differences between two versions of the page.
control_sql_-_vendor_credit_balance_integrity_check [2019/01/27 11:29] 127.0.0.1 external edit |
control_sql_-_vendor_credit_balance_integrity_check [2019/02/05 11:29] (current) admin |
||
---|---|---|---|
Line 23: | Line 23: | ||
<code sql> | <code sql> | ||
SELECT | SELECT | ||
- | (select | + | (SELECT |
- | | + | |
- | | + | |
Account.CompanyName, | Account.CompanyName, | ||
Account.VendorCreditBalance, | Account.VendorCreditBalance, | ||
GLAmount AS GLCreditBalance, | GLAmount AS GLCreditBalance, | ||
- | | + | |
- | Account.ID | + | Account.ID |
- | (select max(EntryDateTime) | + | (SELECT MAX(EntryDateTime) |
- | | + | |
- | | + | |
- | | + | |
FROM | FROM | ||
( | ( | ||
- | | + | |
- | AccountID | + | AccountID |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | ) as A | + | ) AS A |
- | full join | + | FULL JOIN |
( | ( | ||
- | | + | |
- | | + | |
- | | + | |
- | ) as B on A.GLsAccountID = B.VendorAccountID | + | ) AS B ON A.GLsAccountID = B.VendorAccountID |
- | left join Account | + | |
- | where coalesce(A.GLAmount, | + | LEFT JOIN Account |
- | order by Division, CompanyName, | + | WHERE COALESCE(A.GLAmount, |
+ | ORDER BY Division, CompanyName, | ||
</ | </ | ||