The code should multiply price with quantity and group them by name. My code looks like this:
from kund k,varugrupp v, kundorder ko, orderrad o, artikel a
where k.knr = ko.knr
and ko.ordnr = o.ordnr
and o.artnr = a.artnr
group by k.knr,k.fnamn,k.enamn
order by k.knr asc;
I'm not sure what each of those tables represents, but it looks like an order with order lines, each with an item being bought (artikel?)?
Something like that.
So each one of those things you are grouping by has numerous lines, which is why I thought you'd want the total for the order.
Except, you have a spurious table in there (varugrupp) that is not associated with anything, so every row in that table is being mapped to every row resulting from your WHERE clause, so maybe that's where your issue actually lies and SUM is the correct thing to use?
But the other columns returned are about the customer (number and name), so how does multiplying the single line items on every order make sense per customer unless you are adding them up as well?
Remove the group by and all you have is:
And so on.
Multiple lines with a cust id and a sum...even the title of that column implies "a total of what the customer has ordered".