azur-xrl

 

  利用变量实现

set @c_id:=null, @rownum:=0;
select
*
from
(SELECT t.*,
@rownum:= (case when @c_id = t.c_id then @rownum + 1 else 1 end) count,
@c_id:=t.c_id
FROM t_class_message t 
order by t.c_id asc, t.create_time desc ) T
where count < 4 ;

分类:

技术点:

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-02-08
  • 2022-01-01
  • 2022-01-01
  • 2021-11-26
猜你喜欢
  • 2022-01-01
  • 2022-01-01
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案