postgresql7.1 select f.facility_id, f.name as facility_name, r.room_id, coalesce(r.name,'0') as room_name, r.capacity, r.enabled_p from rr_facilities f left join rr_rooms r on f.facility_id = r.facility_id where f.package_id = :package_id order by f.name, r.name