Good morning, I would like to know why my SQL query is not working, I'm using SQL Server 2008 and my GROUP BY
is going wrong. I already checked and the table names are correct and are filled correctly.
Code:
SELECT categoria, nome_categoria
FROM tabela_teste.dbo.teste
WHERE vigencia = '2016-04'
GROUP BY categoria
ORDER BY nome_categoria;
Error:
is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.