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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum columns together under special condition

Status
Not open for further replies.

100bure

IS-IT--Management
Feb 11, 2002
12
CH
Hi

I've got a tabel in access like you see below. And now I would like to add the 5th column together when the 1st, 2nd, 3th and 4th column are the same. I tried to use the SQL funtion SUM() but this didn't work. Does someone know how to sove this problem in access?


1st 2nd 3th 4th 5th 6th 7th 8th 9th
111 400 S 200208 4.261 Auftragseingang 1 Sortimente 11
111 400 S 200208 0.835 Auftragseingang 1 Sortimente 12
111 400 S 200209 5.682 Auftragseingang 1 Sortimente 11
111 400 S 200209 2.513 Auftragseingang 1 Sortimente 12
111 402 S 200210 9.235 Auftragseingang 1 Sortimente 11
111 402 S 200210 2.848 Auftragseingang 1 Sortimente 12
111 403 S 200111 0.506 Auftragseingang 1 Sortimente 12
111 403 S 200112 0.506 Auftragseingang 1 Sortimente 12
 
Try this SQL - substituting your table name.

SELECT Table1.[1st], Table1.[2nd], Table1.[3rd], Table1.[4th], Sum(Table1.[5th]) AS Total
FROM Table1
GROUP BY Table1.[1st], Table1.[2nd], Table1.[3rd], Table1.[4th];
 
Hi

Thank you very much. I had the first part of the select statment like yours but didn't include the GROUP BY.

So, thank you very much.

100bure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top