Skip to Content
0
Jun 27 at 05:01 PM

error-in-the-execution-of-the-query-in-sql-server-when-I-am-using-sum-function

235 Views Last edit Jul 15 at 08:48 AM 2 rev

image.png

here is my database record

and when i am using SUM function to group by productID

AC00001 total amount should be 1500

but it show 2000

image.png

may anyone help me and teach me how to use sum to join the muti-table and sort it at productID?

and final I should use update/ insert into the result into the product table for saving at the database like this
STOCKAmount

image.png

Thanks a lot !!!!!!!!!!!!!!!!!!!!!

Attachments

image.png (70.2 kB)
image.png (46.3 kB)
image.png (170.5 kB)