查询出结果 给其 加上序号的方法 msql

基本用法

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 ;

黄色字段是放入你已经查询好的数据,然后查出来的结果 就会在你查出来的数据前面加一个序列

 

效果:

 

posted @ 2018-11-28 12:07  凯宾斯基  阅读(441)  评论(0编辑  收藏  举报