I was using this query to assign rank to every name according to the votes they have got, but it returns with the error :
1248 - Every derived table must have its own alias
Here is my code:
SELECT @rownum:=@rownum+1 AS rank, name, vote
FROM table, (SELECT @rownum:=0) ORDER BY vote DESC
On modifying the query to this :-
SELECT @rownum:=@rownum+1 AS rank, name, vote
FROM table ORDER BY vote DESC
I get as expected rank of the queries as NULL. Any help , how to get rank at first place ?
NOTE: I am not looking for any alternative solution. Just trying to do it in the query itself.