sum of group showing double of expected value [duplicate]

32
April 16, 2019, at 05:00 AM

This question already has an answer here:

  • MYSQL: JOIN makes SUM double 2 answers
  • SUM returns double value [duplicate] 1 answer

My query is giving an error by doubling its value of SUM by groups from the actual expected value.

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

I expected the output of received quantity citric acid = 6 and zircornium... = 12, but the actual outputs are citric acid =12 and zircornium... = 24

READ ALSO
How to sum calculated years from two columns group by id?

How to sum calculated years from two columns group by id?

I need to create a searching in the staff list according to some criteria selectedI am using ajax in laravel 5

44
How can I INNER JOIN these 3 tables correctly?

How can I INNER JOIN these 3 tables correctly?

I have 3 tablesOrders, copacks, copack_products

56
which hash function to choose for indexing uuid string on mysql? md5,crc64 or fnv

which hash function to choose for indexing uuid string on mysql? md5,crc64 or fnv

I have a column store the uuid stringI add a new column to store its integer(64bits) hash value for indexing

26
MySQL Error seems unfixable: Index column size too large

MySQL Error seems unfixable: Index column size too large

I'm getting: ERROR 1709 (HY000): Index column size too largeThe maximum column size is 767 bytes

37