在mysql中类似oracle的rowid
SELECT @rowNum:=@rowNum + 1 AS '行号',a.* FROM constellation_keywords_info a,(SELECT @rowNum:=0) b;
mysql取分组前3条记录,(性能极差)
https://blog.csdn.net/Jacksun_huang/article/details/88869025
(性能极差)
select a.,count() as num from constellation_analysis_info as a
inner join constellation_analysis_info as b ON a.constellation_code=b.constellation_code
where b.id>=a.id group by a.id having num<=3
MySQL中利用简单SQL实现开窗函数的分组排序功能 (性能极好)
https://jingyan.baidu.com/article/d8072ac48d2730ec94cefd43.html?qq-pf-to=pcqq.c2c
IF(@tmp=dream_type,@rank:=@rank + 1,@rank:=1) as new_rank,
@tmp:=dream_type as tmp FROM
dream_parent_lable a
) b
where new_rank 20
)t2 ON t2.dream_type = t1.dream_type
order by t1.dream_type asc