mysql排序row_number

select * from
(SELECT @rownum:=@rownum+1 AS rownum, apply_author.author_id,apply_author.pv,dt
FROM (SELECT @rownum:=0) r, apply_author ORDER BY pv desc)aa where rownum BETWEEN 1 and 10

---------------------------------------------hive取top md到n

select 'top3' as top,news_id,count(1) as counts from (
SELECT
news_id,
pv,
row_number () over (
PARTITION BY statis_date
ORDER BY
pv DESC
) row_num
FROM
author_pv
WHERE
statis_date = '${yesterday}' and settle_type=2)t1 where t1.row_num between 41 and 60 group by news_id

 

posted @ 2018-02-23 17:59  贪吃的柳柳  阅读(276)  评论(0编辑  收藏  举报