Differences

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

Link to this comparison view

control_sql_-_check_that_gl_accounts_are_under_valid_categories [2019/01/27 11:28]
control_sql_-_check_that_gl_accounts_are_under_valid_categories [2019/01/27 11:28] (current)
Line 1: Line 1:
 +======  ======
 +
 +
 +
 +===== Explanation of SQL =====
 +
 +
 +
 +GL Accounts in Control are ordered in a hierarchy, with all GL Accounts under Groups.  Occassionally, a GL Account may be in Control that is not under a valid GL Account Group.  In this case the account will show in certain cases (when Accounts are listed in a flat list) but not in cases when the hierarchy is used.
 +
 +
 +
 +This query shows any GL Accounts or GL Account Groups that are not under a valid account group.  It should return no results.  If any results are found, they will need to be manually edited and changed so that the AccountGroupID is under a valid (and correct) Account Group.
 +
 +
 +
 +===== 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 * 
 +FROM GLAccount WITH(nolock)
 +WHERE AccountGroupID NOT IN 
 +          (SELECT ID 
 +           FROM GLAccount WITH(nolock) 
 +           WHERE ClassTypeID in (8000, 8050))
 +</code>
 +
 +
 +
 +===== Version Information =====
 +  * Entered : 7/1/2009
 +  * Version : Control 4.3
 +
 +
 +