I have a question.
This is the query :
SELECT a.naam as "Artiest", SUM(o.numberOfOrders) as "Aantal singles",
(SUM(o.numberOfOrders) * s.price) * 0.35 as "Winst
FROM orders o
JOIN singles s ON s.singleid = b.singleid
JOIN artist a ON a.artistid = s.artistid
WHERE b.date= TO_DATE('15/MAY/2012','dd/mon/yyyy')
GROUP BY a.name
When I execute this query I get the error :
“not a GROUP BY expression”
I’ve already tried putting (SUM(o.numberOfOrders) * s.price) * 0.35 in the group by as well,
but then I get the error:
“group function is not allowed here”
How do I fix this?
You want to replace this with one of the following:
or:
or (maybe):
In other words, s.price is not in the group by