$rank = $db->query("
SELECT * FROM
( SELECT a.*, @row:=@row+1
AS `result`
FROM users a, (SELECT @row:=0) s ORDER BY id ASC )
a
WHERE id = '".$user_id."'
");
I found the following query on SO, and am trying to understand how it works. Nothing detailed was mentioned in the answer.
So far I understand everything except the single letters "a" and "s"
What do they mean?