I'm doing a exercise about SQL query and I came up with an error when it comes to SUM. I know what is does, but I somehow get an error...
select
client.LName, client.FName,
COUNT(b.Total)
from
ClientBank client
INNER JOIN
Bank b ON (client.ClientID = b.ClientID)
where
client.LName = 'name' AND client.FName = 'a';
But then I get this error...
Column 'ClientBank.LName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I have tried to do a Group BY, don't really know how to use it well.. Any help would be great!