I have SQL code like this :
SELECT
TB_DataProperti.*,
TBL_Rating.ISNULL(AVG(Rating), 0) AverageRating
FROM
TB_DataProperti
INNER JOIN
TBL_Rating ON TB_DataProperti.Kode_Properti = TBL_Rating.Kode_Properti
GROUP BY
TB_DataProperti.JudulListing
ORDER BY
AverageRating DESC
I get this error:
Msg 8120, Level 16, State 1, Line 3
Column 'TB_DataProperti.Kode_Properti' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I just want to select all data columns using *
, because I have many columns