select
t.hosp_id,
t.hosp_area_id,
t.out_in_flag,
t.critical_type,
t.send_minute,
(@row_number := if(@current_group = CONCAT(t.hosp_id, t.hosp_area_id, t.out_in_flag, t.critical_type),
@row_number + 1,
1)) as order_no,
(@current_group := CONCAT(t.hosp_id, t.hosp_area_id, t.out_in_flag, t.critical_type)) group_no
from
(
select
hosp_id,
hosp_area_id,
out_in_flag,
critical_type,
send_minute
from
dvcvms.critical_send_roles
order by
hosp_id,
hosp_area_id,
out_in_flag,
critical_type,
send_minute) as t
cross join (
select
@row_number := 0,
@current_group := ‘’) as r
01-24
7644
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-08