我正在尝试运行以下查询:
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
但它失败并显示以下消息:
您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在'FULL OUTER JOIN附近使用正确的语法( SELECT wp_posts.post_parent,SUM(第9行的wp_storage_manager.product'
感谢所有帮助者!