SELECT A.customer_name,A.goods_name,A.code,A.wholesale_number,A.wholesale_price,A.wholesale_amount,B.purchase_quantity,C.purchase_quantity1,D.purchase_quantity2 FROM
(SELECT T1.customer_name,T1.goods_name,T1.code,SUM(T1.wholesale_number) AS wholesale_number,SUM(T1.wholesale_price) AS wholesale_price,SUM(T1.wholesale_amount) AS wholesale_amount
FROM 设备清单两表相加结果 T1
GROUP BY T1.customer_name,T1.goods_name,T1.code) A
LEFT JOIN
(SELECT T2.customer_name,T2.goods_name,T2.code,SUM(T2.purchase_quantity) AS purchase_quantity FROM tb_purchase_request_hua T2
GROUP BY T2.customer_name,T2.goods_name,T2.code) B
ON A.customer_name=B.customer_name AND A.goods_name=B.goods_name AND A.code=B.code
LEFT JOIN
(SELECT T3.customer_name,T3.goods_name,T3.code,SUM(T3.purchase_quantity1) AS purchase_quantity1 FROM tb_purchase_receipt_hua T3
GROUP BY T3.customer_name,T3.goods_name,T3.code) C
ON A.customer_name=C.customer_name AND A.goods_name=C.goods_name AND A.code=C.code
LEFT JOIN
(SELECT T4.customer_name,T4.goods_name,T4.code,SUM(T4.purchase_quantity2) AS purchase_quantity2 FROM tb_installation_checklist_hua T4
GROUP BY T4.customer_name,T4.goods_name,T4.code) D
ON A.customer_name=D.customer_name AND A.goods_name=D.goods_name AND A.code=D.code
报错View's SELECT contains a subquery in the FROM clause
设备清单两表相加结果 这个主表也是视图来了~可以解救下吗,大佬,,运行是可以正常,但创视图就报错了 |