Reputation: 802
My statement shows result as
userid Count(userid)
SELECT userid, COUNT( userid )
FROM friends
GROUP BY userid
ORDER BY `COUNT(userid)` DESC
LIMIT 0 , 30
I have 1 more column "level" in friends table need to add it in my result
how tp adjust my statement
So my result appear like
userid Count(userid) level
Upvotes: 0
Views: 93
Reputation: 36954
You may try :
SELECT userid, COUNT( userid ) AS cnt, level
FROM friends
GROUP BY userid
ORDER BY cnt DESC
LIMIT 30
Upvotes: 2