I have these tables:
Hraci:
- IDHrace (int)
- Jmeno (varchar)
Ucast_Zapas:
- ID_Hrace_zapas (int)
- branky (int)
I want SUM how much "branky" WHERE ID_Hrace_zapas=IDHrace and Jmeno="karel" for example...
This is my code:
SELECT
SUM(Ucast_Zapas.Branky), Ucast_Zapas.ID_Hrace_zapas, Hraci.Jmeno,Hraci.IDHrace
FROM
Hraci, Ucast_Zapas
WHERE
(Ucast_Zapas.ID_Hrace_zapas=Hraci.IDHrace) AND (Hraci.Jmeno='smajlik');
I don´t know, where is the problem, SQl writes this error:
Column 'Ucast_Zapas.ID_Hrace_zapas' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.