postgresql7.1
select
$column_name as response,
(case o.creation_user
when null then 'Anonymous_user'
else
person__name(acs_object__get_attribute(r.response_id,'creation_user')::text::integer)
end) as respondent_name,
acs_object__get_attribute(r.response_id,'creation_date') as submission_date,
acs_object__get_attribute(r.response_id,'creation_user') as creation_user,
acs_object__get_attribute(r.response_id,'creation_ip') as ip_address
from
survey_responses r,
survey_question_responses qr,
acs_objects o
where
qr.response_id = r.response_id
and qr.question_id = :question_id
and o.object_id = qr.response_id
order by submission_date