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? Quote 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; Quote Link to comment https://forums.phpfreaks.com/topic/177741-maxcount-in-a-row/#findComment-937193 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.