组的总和显示出期望值的两倍

时间:2019-04-15 06:40:06

标签: mysql

我的查询通过将其SUM值与实际期望值成倍增加而给出错误。

SELECT `tabimport permission received items`.item_received          AS "Item", 
       Sum(`tabimport permission received items`.received_quantity) AS 
       "Recieved Quantity", 
       `tabimport permission received items`.permission_number, 
       `tabimport permission item`.parent                           AS 
       "Doc Name", 
       `tabimport permission item`.quantity_applied                 AS 
       "Applied Quantity", 
       ( `tabimport permission item`.quantity_applied - Sum( 
         `tabimport permission received items`.received_quantity) ) AS 
       "Balance Quanity" 
FROM   `tabimport permission received items` 
       LEFT JOIN `tabimport permission item` 
              ON `tabimport permission received items`.permission_number = 
                 `tabimport permission item`.parent 
GROUP  BY `tabimport permission received items`.item_received

我希望接收到的柠檬酸= 6和锆锆... = 12的输出,但实际输出是柠檬酸= 12和锆锆... = 24

0 个答案:

没有答案