Is there a way to remove or filter out duplicate entries? I have imported some data for a client, and it turns out there are some duplicates in the csv-files.

Is there an easy way to remove or filter out duplicates, either in my entries-query or in my template?

My query looks like this now

{% set dealers = craft.entries({section:'dealers'}).order('dealerName') %}


Thanks!
First you would need to figure out how to identify duplicates.

Craft doesn’t allow duplicate entry slugs; it will append “-1”, “-2”, etc. to them to keep them unique. So that would probably be a good starting point.

Use this query to get a list of all entries that have a number appended to the end of the slug. It’ll tell you the entry title, its section’s name, and the URL to edit it in the control panel. (Just update “example.com” with the actual host name.) Go through those and use your best judgement to decide which ones should be deleted.

SELECT c.title, s.name AS sectionName, CONCAT('http://example.com/admin/entries/', s.handle, '/', el.elementId) AS cpUrl
FROM craft_elements_i18n el
INNER JOIN craft_content c ON c.elementId = el.elementId
INNER JOIN craft_entries en ON en.id = el.elementId
INNER JOIN craft_sections s ON s.id = en.sectionId
WHERE el.slug REGEXP '\-[0-9]+$'