I am in the aggregates lecture, and all of the aggregate functions are not working; I mean, they don’t turn blue.
please help
You have a space between SUM
and (
.
it worked but i still got an error message, though it still didn’t get highlighted in blue like in the tutorial videos. thanks anyway.
Hi, you have the wrong column name it is ‘invoice_total’ not ‘invoicing_total’ in the invoices table.
Also sum is not blue for me, its purple because its function it shows differently, I think because Mosh was on older version of MySQL Workbench thats why he was blue
worked just fine; mine is actually light gray.
thanks a lot.
Hi everyone!
I am on the aggregate function lecture and I am writing the following code :-
SELECT
p.date,
SUM(p.amount) AS total_payments,
pm.name as payment_method
FROM payments p
JOIN payment_methods pm
ON p.payment_id = pm.payment_method_id
GROUP BY p.date;
I am getting an error :Error code 1055. Select list is not in GROUP BY clause. Mosh entered the same code and his worked
Mosh groups by date
and payment_method
.
@SAM Thank you for your response. Can you please help me understand why my code could be getting an error?
Thank you in advance
All SELECT
ed columns that are not aggregates should be GROUP
ed. That’s what the error message says.
If you have multiple payment_method
s used on a date
and group by date
only - which payment_method
value should the database return? Either would be wrong since the SUM
includes them all.