Translate Page To German Tranlate Page To Spanish Translate Page To French Translate Page To Italian Translate Page To Japanese Translate Page To Korean Translate Page To Portuguese Translate Page To Chinese Translate Page To Russian Translate Page To Dutch

09 Jan 2009 
Support Center » Knowledgebase » How to select all products with the same name (find duplicates)?
 How to select all products with the same name (find duplicates)?
Solution

You should use Advanced -> Custom SQL section to execute following SQL query:

Select Count(products_description.products_name) As number_of_occurrences,
products_description.products_name, products.products_model
From products
Inner Join products_description On products_description.products_id = products.products_id
Where products_description.language_id = 1
Group By products_description.products_name
Order By number_of_occurrences Desc

As a result it will show data grid with three columns - "Number of Occurrences", "Product Name" and "Product Model". Result data will be sorted by number of occurrences product name i.e. it will find duplicate product names and show "most duplicated" first.

Note that in SQL above there's a part highlighted with bold - this part determines grouping condition - those field you like to find duplicates by.

Another part highlighted with bold red - determines the language you like to find duplicates for. The point is that you can have some product which have English name the same as in some other product but unique German name at the same time so you have to specify which language should be used for searching.

If you have no idea what language_id used in your database (for particular language) open Advanced -> Raw Table Editor and search for table "languages". Doubleclick this table to see its contents and find out what languages you have and what are their ids.

Query below is almost the same as previous one except those part that determine field you want to search for duplicates by. It will find products with similar product model:

Select Count(products_description.products_name) As number_of_occurrences,
products_description.products_name, products.products_model
From products
Inner Join products_description On products_description.products_id = products.products_id
Where products_description.language_id = 1
Group By products.products_model
Order By number_of_occurrences Desc

Those users who have real need to search for duplicates on regular basis and spend much time on this task may use mentioned queries to create custom report(s) for every language and/or using different search conditions.

We may extend this article depending on visitor interest to this problem so please write your comments and questions :)



Article Details
Article ID: 55
Created On: 15 Jun 2007 01:55 AM

 This answer was helpful  This answer was not helpful

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Troubleshooter | News | Downloads | Support Forum | Public Bug Tracker | Documentation | Beta Testers
Language:

Help Desk Software By Kayako SupportSuite v3.30.01