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