select t.*
from dengji_hotel t
order by to_char(t.rz_date,'yyyymmdd')
         ,t.hotel_name
         ,t.hotel_room
         ,id desc

解决方案 »

  1.   

    select * from dengji_hotel a,
    (select id,name,row_number()over(partition by to_char rz_date,'yyyymmdd'),hotel_name,hotel_room order by id) rn from dengji_hotel) b
    where a.id = b.id and b.rn > 1;
      

  2.   

    select * from dengji_hotel where rowid in (
    select rid from (
      select count(id)over(partition by trunc(rz_date),hotel_name,hotel_room)as rank_id, rowid as rid from dengji_hotel
    )
    where rank_id >= 2
    )