SELECT tt.id, ( @rowNum := @rowNum + 1 ) AS ranking FROM ( select 5 as id union all select 4 as id union all select 3 as id union all select 2 as id union all select 1 as id ORDER BY id ) tt ,( SELECT ( @rowNum := 0 ) ) as e
标签:以下,union,tt,mysql5.6,rowNum,排序,id,select From: https://www.cnblogs.com/suheng01/p/17235552.html