{"id":1629,"date":"2021-03-08T09:00:36","date_gmt":"2021-03-08T09:00:36","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/sql-query-to-find-duplicate-increment-id-from-order-table\/"},"modified":"2025-09-01T11:40:25","modified_gmt":"2025-09-01T06:10:25","slug":"sql-query-to-find-duplicate-increment-id-from-order-table","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/sql-query-to-find-duplicate-increment-id-from-order-table\/","title":{"rendered":"SQL Query to Find Duplicate Increment_ID From Order Table"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Upgrading Magento stores can be quite a daunting task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, you may face errors or issues if the upgrade process is not handled with expertise.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, an issue of duplicate record from the order table arises while upgrading the store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/use-sql-query-for-case-sensitive-data-in-magento-2\/\">Magento 2 use SQL Query for case sensitive data<\/a>&nbsp;as it is crucial for scenarios like these.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">P.S: If you don\u2019t want to go through such issues while the upgrade process, opt for the professional\u00a0<a href=\"https:\/\/meetanshi.com\/magento-upgrade-service\" target=\"_blank\" rel=\"noreferrer noopener\">Magento Upgrade <\/a><a href=\"https:\/\/meetanshi.com\/magento-upgrade-service.html\" target=\"_blank\" rel=\"noreferrer noopener\">Service<\/a>\u00a0by Meetanshi!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL Query to Find Duplicate Increment_ID From Order Table<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT increment_id FROM sales_flat_order group by increment_id having count(*) >= 2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Just use the above SQL query and find whether your table has duplication in increment_id or not.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Find duplicate increment_id and modify the records that have duplication!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s all!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;.<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1629","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1629"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1629\/revisions"}],"predecessor-version":[{"id":21384,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1629\/revisions\/21384"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}