Guest Posted May 27, 2007 Share Posted May 27, 2007 I want to find the most occurring rows in a table. Lets say i want to find the most with the column Owner_ID how can i find this out? Link to comment https://forums.phpfreaks.com/topic/53140-most-occurring/ Share on other sites More sharing options...
Barand Posted May 27, 2007 Share Posted May 27, 2007 SELECT Owner_ID, COUNT(*) as total FROM tablename GROUP BY Owner_ID ORDER BY total DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/53140-most-occurring/#findComment-262522 Share on other sites More sharing options...
Guest Posted May 27, 2007 Share Posted May 27, 2007 Thank You thanks what I needed. Link to comment https://forums.phpfreaks.com/topic/53140-most-occurring/#findComment-262526 Share on other sites More sharing options...
bubblegum.anarchy Posted May 27, 2007 Share Posted May 27, 2007 SELECT Owner_ID, COUNT(*) as total FROM tablename GROUP BY Owner_ID ORDER BY total DESC LIMIT 1 What about situations that involve more that one grouped record containing the highest total count? Link to comment https://forums.phpfreaks.com/topic/53140-most-occurring/#findComment-262610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.