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

.net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

iphone - Smoothing a rounded stroke in Core Graphics -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -