Skip to content

Instantly share code, notes, and snippets.

@tisuchi
Last active July 26, 2018 04:00
Show Gist options
  • Save tisuchi/692913a548bc5c5c776f5fe59945ff70 to your computer and use it in GitHub Desktop.
Save tisuchi/692913a548bc5c5c776f5fe59945ff70 to your computer and use it in GitHub Desktop.
Adding Product in Admin
==================================
SELECT
product.*, product_variation.*, product_option.*
FROM product
LEFT JOIN product_variation ON product_variation.product_id = product.product_id
LEFT JOIN product_option ON product_option.product_id = product.product_id
LEFT JOIN order_product ON order_product.product_id = product.product_id
LEFT JOIN customer_order ON customer_order.order_id = order_product.order_id
WHERE customer_order.order_id = 2126;
Adding Product via API
==================================
SELECT
product.*, product_variation.*, product_option.*
FROM product
LEFT JOIN product_variation ON product_variation.product_id = product.product_id
LEFT JOIN product_option ON product_option.product_id = product.product_id
LEFT JOIN order_product ON order_product.product_id = product.product_id
LEFT JOIN customer_order ON customer_order.order_id = order_product.order_id
WHERE customer_order.order_id = 2127;
Note: Please run this query to the Sandbox DB.
@avana-sky
Copy link

SELECT 
		customer_order.*, order_product.*
	FROM customer_order
	LEFT JOIN order_product ON order_product.order_id = customer_order.order_id
	WHERE customer_order.order_id IN (2126,2127);

Run this from Sandbox DB. You'll see the difference of data

@tisuchi
Copy link
Author

tisuchi commented Jul 26, 2018

Query for creating the new project. Need to compare with Production.

SELECT 
	product.*, product_description.*
FROM product
JOIN product_description ON product_description.product_id = product.product_id
WHERE product.product_id IN (847, 848);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment