postgresql7.4 SELECT map.map_id, uos.uos_code, uos.uos_name, uos.uos_id, rev.year_id, y.name, rev.semester_ids, rev.core_id, map.live_revision_id, map.latest_revision_id FROM cc_uos uos, cc_stream_uos_map map, cc_stream_uos_map_rev rev, cc_year y WHERE uos.uos_id = map.uos_id AND map.stream_id = :stream_id AND map.latest_revision_id = rev.map_rev_id AND rev.year_id = y.year_id AND rev.year_id != 0 SELECT cc_stream__name(:stream_id) SELECT cc_semester__name(:semester_id) SELECT map.map_id, uos.uos_code, uos.uos_name, uos.uos_id, rev.year_id, map.live_revision_id, map.latest_revision_id FROM cc_uos uos, cc_stream_uos_map map, cc_stream_uos_map_rev rev WHERE uos.uos_id = map.uos_id AND map.stream_id = :stream_id AND map.latest_revision_id = rev.map_rev_id AND rev.year_id = 0