Hi all,
I wrote the same query as Mosh, why it won’t execute, and shows “Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘sql_invoicing.invoices.invoice_total’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by”
Pls help me debug this , thanks alot!
BTW, why my aggregation code(SUM, AVG,etc)never blue/bold?
I tried different fiddle site and got different output. Likely your configuration differs from Mosh’s configuration. It is possible the defaults have changed since the course content.
As of why SUM is not blue, this is simply because it is a function and not a keyword such as CREATE VIEW, SELECT, FROM, JOIN, GROUP BY, you name it.
Your code completion works perfectly. It is in a lighter gray.
Now for the error message on itself it is a bit of an exercice to me too.
I will tell you how I understand it.
Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘sql_invoicing.invoices.invoice_total’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
invoice_total is not functionally dependent on columns in GROUP BY clause means that you cannot determine invoice_total from those columns.
As of Expression #3 I believe it talks about the aggregate function AS balance.
I would definitely give it a try but I did not take that course and I don’t know the scruture of the tables.
For what I understand you have
Client
------
client_id
name
Invoices
--------
invoice_id
invoice_total
payment_total
client_id
Could you please run those for me and send me the result?
It will just give the 5 first rows for each table. That would help to understand.
SELECT * FROM clients LIMIT 5;
SELECT * FROM invoices LIMIT 5;