I'm new at programming with PHP/mySQL and I have got a little problem here.
This is how my code looks like:
SELECT
COUNT(*) AS Number , Name
FROM
table
GROUP BY
Name
ORDER BY
Number DESC
LIMIT 100
Out of this table:
Oliver
Michael
Oliver
Steven
Michael
Oliver
Oliver
... it generates:
Oliver | 4
Michael | 2
Steven | 1
My question: How can I add ranking numbers so that it looks like this:
1 | Oliver | 4
2 | Michael | 2
3 | Steven | 1
Thanks for your help!
1 Oliver 4
,1 Michael 4
,3 Steven 1
or1 Oliver 4
,2 Michael 4
,3 Steven 1
? Q2) Suppose Michael and Steven had 2. Would the ranking be :1 Oliver 4
,2 Michael 2
,3 Steven 2
or1 Oliver 4
,2 Michael 2
,2 Steven 1
?