Skip to content

Instantly share code, notes, and snippets.

@osrecio
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save osrecio/64d063c6ee56c70836a6 to your computer and use it in GitHub Desktop.

Select an option

Save osrecio/64d063c6ee56c70836a6 to your computer and use it in GitHub Desktop.
Get Duplicate Orders in Magento
SELECT `quote_id`,
COUNT(`quote_id`) AS `qty_duplicates`,
`increment_id` AS `first_increment_id`,
GROUP_CONCAT( `increment_id` SEPARATOR ' | ' ) AS `increment_ids`,
`created_at`,
`state`,
`status`,
`customer_firstname`,
`customer_lastname`,
`customer_email`,
`grand_total`
FROM `sales_flat_order`
GROUP BY `quote_id`
HAVING COUNT(`quote_id`) > 1
ORDER BY `created_at` ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment