SELECT A.*
          , FN_SY_CLASS_R01(rs_status_cd,'CLASS_NM') AS rs_status_nm
          ,(SELECT FN_BA_CLASS_INFO_R01(B.room_type,'CLASS_NM') FROM RS_HROOM B WHERE B.rs_hmst_seq = A.rs_hmst_seq ORDER BY B.day ASC LIMIT 1) AS room_type_nm 
          ,(SELECT X.room_name 
            FROM RS_HROOM B
            INNER JOIN HT_ROOM_INFO X ON B.ht_room_info_seq = X.ht_room_info_seq
            WHERE B.rs_hmst_seq = A.rs_hmst_seq ORDER BY B.day ASC LIMIT 1) AS room_name 
          ,C.htl_name
          , IFNULL(P.pay_amt,0) AS pay_amt
          , P.daoutrx
FROM RS_HMST A
INNER JOIN HT_MST C ON A.ht_mst_seq = C.ht_mst_seq
LEFT OUTER JOIN RS_HPAY P ON A.rs_hmst_seq = P.rs_hmst_seq
WHERE A.ins_id = :login_id
:_filterQuery
ORDER BY rs_hmst_seq DESC