人本善良

导航

MySql PartionBy

SELECT tableOld.*,
if(@channelName = tableOld.channelName,
@rank := @rank + 1,
@rank := 1)
AS rank,
@channelName := tableOld.channelName
FROM (SELECT *
FROM OpearateTableResultDockerForPage
ORDER BY channelName, date ASC) tableOld,
(SELECT @channelName := NULL, @rank := 0) a;

posted on 2017-05-16 11:58  简简单单2018  阅读(415)  评论(0编辑  收藏  举报