Skip to content
Advertisement

SQL SUM of Article-Prizes

i’m an absolute newbie in SQL and want to add up all the Sums of the Articles * ordered amount to a final prize. I tried to calculate the Articles * amount to the “Gesamtpreis” and then the Method SUM() to sum up all the “Gesamtpreis”. Dont worry, the SQL-Code is auto-generated by Access.

Main Problem:

Whole Code:

Advertisement

Answer

When using an aggregate function (e.g. SUM(), COUNT(), etc.), you need to group by every other field which is not part of an aggregate function in that query. For your case, it would be like this:

EDIT: If you are looking for the SUM of all entries to appear on each entry, then you could do that like this:

EDIT: If you are looking for the sum of entries for each Kunden:

EDIT: If you are looking for the sum of entries for each Kunden and Bestellung:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement