Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing up According to each Product-Name

Status
Not open for further replies.

118600

Vendor
Feb 15, 2005
36
DE
Hi Guys,


My problem is that i want to add sold items in ACCESS according to Product name such a way that each Item must be added each time relevant to product name.

Expected sum is also given at the end, that what i am looking for.

Anyone can help me regarding this ?


Serial_Nr Product_Name Sold Expected sum

1 NX-1 1 1
2 NX-1 2 3
3 NX-1 1 4
4 NX-1 5 9
5 NY-10 2 2
6 NY-10 3 5
7 NY-10 3 8
8 NY-10 1 9
9 NZZ-10 2 2
10 NZZ-10 3 5
11 NZZ-10 4 9
12 NZZ-11 1 1


I will be thankful,

regards,

 
where do you need it to display this in a form, report etc
 
You want a running total ?
SELECT A.Serial_Nr, A.Product_Name, A.Sold, Sum(B.Sold) As [Expected sum]
FROM yourTable A INNER JOIN yourTable B ON A.Product_Name = B.Product_Name AND A.Serial_Nr >= B.Serial_Nr
GROUP BY A.Serial_Nr, A.Product_Name, A.Sold;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

Thanks a lot PHV (MIS)
Its working. Thats what i was looking for..... i have created another table with same values and got the given result.

M8KWR (Programmer) its regarding query, i dont need to display it on form or report.

chreers,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top