postgresql7.1 select coalesce(initial_response_id,response_id) as initial_response_id from survey_responses where response_id=:response_id