帮忙看个SQL语句
select ToiletryId,count(ToiletryId) as 'cost',ToiletryName,Path from ToiletryLike,Toiletry where Flag=2 and Toiletry.Id=ToiletryLike.ToiletryId and City='北京' group by ToiletryId order by cost desc
有什么语法错误,在查询分析器里我试了,提示说:
Server: Msg 8120, Level 16, State 1, Line 1
Column 'Toiletry.ToiletryName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'Toiletry.Path' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Toiletry里的两个字段为什么不管用,