Index: openacs-4/packages/survey/www/admin/responses-export-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/responses-export-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey/www/admin/responses-export-postgresql.xql 31 Oct 2002 13:36:21 -0000 1.1 @@ -0,0 +1,64 @@ + + + + postgresql7.1 + + + +select + sq.response_id, + sq.question_id, + sq.email, + sq.first_names, + sq.last_name, + sq.user_id, + sq.creation_date, + resp.boolean_answer, + resp.number_answer, + resp.date_answer, + resp.varchar_answer, + resp.clob_answer, + resp.attachment_answer, + resp.label + from + (select + sqr.response_id, + sqr.question_id, + sqr.boolean_answer, + sqr.number_answer, + sqr.date_answer, + sqr.varchar_answer, + sqr.clob_answer, + sqr.attachment_answer, + sqc.label, + sqc.sort_order + from + survey_responses sr, + survey_question_responses sqr left join + survey_question_choices sqc using(question_id,choice_id) + where + sr.survey_id=:survey_id + and sr.response_id=sqr.response_id) resp, + (select r.response_id, + q.question_id, + u.email, + u.first_names, + u.last_name, + r.user_id, + r.creation_date, + q.abstract_data_type, + q.sort_order + from survey_questions q, (select initial_user_id as user_id, creation_date, response_id from survey_responses_latest where survey_id=:survey_id) r, cc_users u, survey_sections ss + where ss.survey_id=:survey_id + and q.section_id=ss.section_id + and r.user_id=u.user_id) sq + where sq.response_id = resp.response_id + and sq.question_id = resp.question_id + order by + sq.response_id, + sq.sort_order, + sq.question_id, + resp.sort_order + + +