select *
from hotel_addition_orders a
where (select count(*)
from hotel_addition_orders
where hotel_order_id = a.hotel_order_id and type > a.type)<2
order by a.hotel_order_id asc, a.type desc;
#班级排名----比我分数高的人少于2,那我就排第二名
select *
from hotel_addition_orders where type = 2;
select *
from hotel_addition_orders a
where
(select count(0) from hotel_addition_orders b where b.hotel_order_id = a.hotel_order_id and type in(1,2,5)) = 3
group by hotel_order_id order by hotel_order_id desc;