-
-
Save purezhi/4712dce262cf2405203a37e9bbfaf80e to your computer and use it in GitHub Desktop.
MySQL: 为查询结果自动编号
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1、为查询结果自动编号: | |
select | |
(@rowNO := @rowNo+1) AS rowno, | |
user_name | |
from ( | |
select | |
wu.screen_name as user_name | |
from base_wb_ids_pr_hobbies mt | |
left join base_wb_user wu | |
on mt.uid = wu.id | |
where mt.hobby_id = 224424 | |
order by -mt.pagerank | |
limit 1000 | |
) a, (select @rowNO :=0) b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment