0
Hello!
In the system there is data collection for some questions and the answers are 0-100. My database has the following tables: Person, Question, Personal.
I’m trying to get a select where to return the question id, the question itself and the average answer between that question. To do such action I am using the following query:
SELECT ppr.IdPergunta, p.Pergunta , AVG(ppr.Valor) as MediaPergunta FROM Pessoa_Pergunta_Resposta ppr, Perguntas p WHERE ppr.IdPergunta = p.Id GROUP BY ppr.IdPergunta
But it gives the titled error. I know the question should be in the aggregation function or group by, but from what I learned, it would not make sense to put it. They would have some light?
Thank you!
Change your clause
GROUP BY ppr.IdPerguntaforGROUP BY ppr.IdPergunta, p.Pergunta. Why do you think you should not put it in the GROUP BY clause?– anonimo
i had tried this, and had given error... Now with your query worked, I was doing something wrong. Thank you!
– bena