基本用法
SELECT
@rownum := @rownum +1 AS rownum,
e.*
FROM
(SELECT
@rownum := 0) r ,
(select A.id,B.user_uuid, A.mobile1 ,count( B.user_uuid) FROM user A , c_user_custom B WHERE A.uuid = B.user_uuid Group By user_uuid ORDER BY count( B.user_uuid) )e ;
黄色字段是放入你已经查询好的数据,然后查出来的结果 就会在你查出来的数据前面加一个序列
效果: