postgresql7.4 SELECT lab_id, name, start_date, end_date, to_char(start_date, 'YYYY') AS year FROM lrc_lab WHERE package_id = :package_id ORDER BY year DESC, name ASC