I'm trying to run the following query:
SELECT tmp1.post_parent, external_qty, internal_qty
FROM (
SELECT wp_posts.post_parent, SUM(wp_shoesol_inventory.qty) as external_qty
FROM wp_posts
INNER JOIN wp_variation_sku ON (wp_posts.ID = wp_variation_sku.variation_id)
INNER JOIN wp_shoesol_inventory ON (wp_shoesol_inventory.sku = wp_variation_sku.sku )
GROUP BY wp_posts.post_parent
) as tmp1
FULL OUTER JOIN (
SELECT wp_posts.post_parent, SUM(wp_storage_manager.product_quantity) as internal_qty
FROM wp_posts
INNER JOIN wp_variation_sku ON (wp_posts.ID = wp_variation_sku.variation_id)
INNER JOIN wp_storage_manager ON (wp_storage_manager.variation_id = wp_variation_sku.sku )
GROUP BY wp_posts.post_parent
) as tmp2 ON tmp1.post_parent = tmp2.post_parent
But it fails with the following message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FULL OUTER JOIN ( SELECT wp_posts.post_parent, SUM(wp_storage_manager.product' at line 9
Thanks to all the helpers!