5
I’m trying to do the following SELECT:
SELECT P.Nome,P.TipoId,P.QuantidadeMensal FROM StockPhotos.Pacote P GROUP BY P.QuantidadeMensal;
But I’m getting this error message:
Message 8120, Level 16, Status 1, Line 2
Column 'Stockphotos.Pack.Name' is invalid in the select list because it is not contained in either an Aggregate Function or the GROUP BY clause.
I don’t understand what the problem is, because Nome
is being selected.
What result do you want? I couldn’t really understand, at first, the SQL server is grouping only by Quantityand therefore, once it groups by monthly amount, it doesn’t know what to do with Tipoid and Name because they are not in an aggregation function ( I didn’t understand exactly what you need too, so I can only point out the error) .
– John Diego