Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
control_sql_-_find_gl_out_of_balances [2019/02/05 11:17]
admin
control_sql_-_find_gl_out_of_balances [2019/02/05 11:18] (current)
admin
Line 20: Line 20:
 <code sql> <code sql>
 -- GL Out of Balance Breakdown -- GL Out of Balance Breakdown
 +  
 + 
 DECLARE @StartDate DateTime DECLARE @StartDate DateTime
 DECLARE @EndDate DateTime DECLARE @EndDate DateTime
 SET @StartDate = '​1/​1/​2008'​ SET @StartDate = '​1/​1/​2008'​
 SET @EndDate ​  = '​1/​1/​2020'​ SET @EndDate ​  = '​1/​1/​2020'​
 + 
 SELECT SELECT
     (SELECT DivisionName AS Division     (SELECT DivisionName AS Division
Line 66: Line 67:
         DatePart(HOUR,​ EntryDateTime),​         DatePart(HOUR,​ EntryDateTime),​
         OffBalanceSheet         OffBalanceSheet
-    HAVING ​   (SUM(Amount) ​ 0)+    HAVING ​   (SUM(Amount) ​<> ​0)
 ) AS OOBGL ) AS OOBGL
 + 
 LEFT OUTER JOIN TransHeader ON TransHeader.ID = OOBGL.TransHeaderID LEFT OUTER JOIN TransHeader ON TransHeader.ID = OOBGL.TransHeaderID
- 
 LEFT OUTER JOIN Account ON TransHeader.AccountID = Account.ID LEFT OUTER JOIN Account ON TransHeader.AccountID = Account.ID
 +ORDER BY Division, TheDate DESC, TheHour DESC, OrderNumber,​ BillNumber
  
-ORDER BY Division, TheDate DESC, TheHour DESC, OrderNumber,​ BillNumber 
 </​code>​ </​code>​