divinequran Posted October 15, 2009 Share Posted October 15, 2009 Hi, How do i select max count of a table in a single query. Eg: select type, count(*) as cc, [color=red]maxcount[/color] from t1 group by type; This is a example query i want the max row count to be printed in the same row. Is it possible? Link to comment https://forums.phpfreaks.com/topic/177741-maxcount-in-a-row/ Share on other sites More sharing options...
corbin Posted October 15, 2009 Share Posted October 15, 2009 If you're trying to do what I think, this should work: SELECT type, COUNT(type) as cc FROM t1 GROUP BY type ORDER BY t1 DESC LIMIT 1; Link to comment https://forums.phpfreaks.com/topic/177741-maxcount-in-a-row/#findComment-937193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.