Skip to content

Instantly share code, notes, and snippets.

@ceckoslab
Created July 28, 2014 15:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceckoslab/5c5a8cdcdf271f3892bf to your computer and use it in GitHub Desktop.
Save ceckoslab/5c5a8cdcdf271f3892bf to your computer and use it in GitHub Desktop.
Check if order items are owned by the current customer
SELECT `oi`.`item_id`, `o`.`customer_id` FROM `sales_flat_order_item` AS `oi`
RIGHT JOIN `sales_flat_order` AS `o` ON oi.order_id = o.entity_id and o.customer_id != 8 WHERE (oi.item_id IN(2, 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment