There is no problem with the quantity when printing, but the number is wrong when sum?

SELECT ss.quan FROM `stock` as ss
          JOIN `order_record` as r ON r.order_id = ss.order_id
          WHERE ss.from = "c"
          AND r.from = "c"
          AND r.status = "ing"
          AND ss.prod_id = 120
          GROUP BY ss.order_id

this is exported by a number of databases:
clipboard.png



32
clipboard.png

GROUP BY ss.order_id 32
order_id
clipboard.png

this may be well understood by
. I just want to ask that the initial numerals are correct
when sum is not correct
what should I pay attention to when using sum? Can"t be so direct sum?

Oct.17,2021

is estimated to be because your ss.order_id has duplicate data. All the relevant data are posted to have a look at


Why don't you just do the calculation and verification on the outside layer. No, no, no. There must be something wrong with your data and your logic. If the data are wrong.

Menu