postgresql7.1 select survey_response__initial_response_id(:response_id) as initial_response_id select count(*) from survey_responses where survey_id=:survey_id and survey_response__initial_user_id(response_id)=:user_id