SELECT A.*
FROM HT_ROOM A
WHERE A.ht_mst_seq = :ht_mst_seq
AND A.ba_comp_seq = :channel_comp_seq
AND A.ht_room_info_seq = :ht_room_info_seq
AND A.day > :today
AND A.view_yn = 'Y'
AND A.room_cnt - IFNULL((SELECT SUM(R.room_cnt) 
        FROM RS_HROOM H 
        INNER JOIN RS_HMST R ON R.rs_hmst_seq = H.rs_hmst_seq
        WHERE H.ht_room_seq = A.ht_room_seq
        AND R.rs_status_cd != 'RSSTAA004'
       ),0) > 0
ORDER BY A.day ASC