Differences

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

Link to this comparison view

control_sql_-_duplicate_companies [2019/01/27 11:28] (current)
Line 1: Line 1:
 +====== ​ ======
 +
 +
 +
 +Control provides an option as to whether duplicate companies are allowed. ​ Even with this option set to not allow duplicates, they may be created from import or have been there from the past.  This query will help identify the duplicate company names in the system.
 +
 +
 +
 +===== Explanation of SQL =====
 +
 +
 +
 +If a customer receives a "​company already exists"​ message when trying to add a company record in the system, you can usually identify the pre-existing company using Company Explorer. ​ Make sure all options are selected (prospect, client, vendor, personal, etc.) and that inactive companies are also being searched.
 +
 +
 +
 +For a complete listing of duplicate company names, you can use the following query.
 +
 +
 +
 +===== 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 CompanyName,​ Count(CompanyName) AS TheCount
 +FROM Account
 +GROUP BY CompanyName
 +HAVING Count(CompanyName) > 1
 +ORDER BY TheCount DESC, CompanyName
 +</​code>​
 +
 +
 +
 +===== Version Information =====
 +  * Entered : 8/15/2009
 +  * Version : Control 2.5+
 +
 +
 +