🔥 Just Launched! Werra Premium Template for HyväSee it in Action

SQL Query to Find Duplicate Increment_ID From Order Table

By Jignesh ParmarUpdated on May 22, 2025 1 min read

Upgrading Magento stores can be quite a daunting task.

Moreover, you may face errors or issues if the upgrade process is not handled with expertise.

For instance, an issue of duplicate record from the order table arises while upgrading the store.

In this case, you can simply run an SQL query to find duplicate increment_ID from the order table in Magento 2 store. Not only during the upgrade process but in any case where you want to find the duplicate entries in the order table, use the below solution. Additionally in Magento 2 use SQL Query for case sensitive data as it is crucial for scenarios like these.

P.S: If you don’t want to go through such issues while the upgrade process, opt for the professional Magento Upgrade Service by Meetanshi!

SQL Query to Find Duplicate Increment_ID From Order Table

SELECT increment_id FROM sales_flat_order group by increment_id having count(*) >= 2

Just use the above SQL query and find whether your table has duplication in increment_id or not.

Find duplicate increment_id and modify the records that have duplication!

That’s all!

Feel free to share the solution with Magento Community via social media.

Thank You.

Jignesh Parmar Full Image
Article byJignesh Parmar

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.