mysql - Quick SQL question! Sort by most occurences of an attribute -


Item ID - Name - Category ID - DCC - Price

I want a query that lists the categories sorted by most events in the items table

This should do the trick:

  SELECT c.ID, C.Name, count (i.id) FROM CROM order CID order by group C at the LEFT JOIN item i (c.ID = i.CategoryID) group By counting (id)  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -