Need a table with answers from particular quizz 13 Years, 9 Months ago
|
Karma: 0
|
Hello,
I have a big hope that you can help me easly.
I am using ari quiz for registration to medical conference.
There are 3 questions:
1) Name and surname (text question, `QuestionId` =430)
2) City (text question, `QuestionId` =431)
3) medical doctor or student (single question, `QuestionId` =432)
I'd love to get a table showing me in one row:
Name and surname | City | md / student
*It doesn't have to be included into joomla.
For example:
David Dickson | Chicago | medical doctor
Andrew Pas | Berlin | student
Matthew Palczewski | Wroclaw | student
Do you have any ideas?
I was trying with SQL question:
SELECT *
FROM `jos_ariquizstatistics`
WHERE `QuestionId` =430
OR `QuestionId` =431
OR `QuestionId` =432
LIMIT 0 , 30
but it's not satisfying me because:
- text answers looks like <answers><answers>[?] Matthew Palczewski</answer></answers>
- records are not in one row
Is it possible with your ARI Quiz system to get such an expected by me effect?
Thanks a lot for your time!
Mat
|
|
|
|
|
Re:Need a table with answers from particular quizz 13 Years, 9 Months ago
|
Karma: 760
|
Hello,
Could you specify what version of MySQL is installed on your server?
Regards,
ARI Soft
|
|
|
|
|
Re:Need a table with answers from particular quizz 13 Years, 9 Months ago
|
Karma: 0
|
Sure,
it's MySQL 5.
Thanks
|
|
|
|
|
Re:Need a table with answers from particular quizz 13 Years, 9 Months ago
|
Karma: 760
|
If MySQL v. 5.1+ is installed on your server, you can use the following SQL query:
Code: |
SELECT
ExtractValue(S_NAME.Data, 'answers/answer') AS Name,
ExtractValue(S_CITY.Data, 'answers/answer') AS City,
SUBSTR(
QV_DEGREE.Data,
LOCATE(
'>',
QV_DEGREE.Data,
LOCATE(
ExtractValue(S_DEGREE.DATA, 'answers/answer/attribute::id'),
QV_DEGREE.Data
)
)
+
1,
LOCATE(
'</answer>',
QV_DEGREE.Data,
LOCATE(
ExtractValue(S_DEGREE.DATA, 'answers/answer/attribute::id'),
QV_DEGREE.Data
)
)
-
LOCATE(
'>',
QV_DEGREE.Data,
LOCATE(
ExtractValue(S_DEGREE.DATA, 'answers/answer/attribute::id'),
QV_DEGREE.Data
)
)
-
1
) AS Degree
FROM
jos_ariquizstatisticsinfo SI LEFT JOIN jos_ariquizstatistics S_NAME
ON SI.StatisticsInfoId = S_NAME.StatisticsInfoId
LEFT JOIN jos_ariquizstatistics S_CITY
ON SI.StatisticsInfoId = S_CITY.StatisticsInfoId
LEFT JOIN jos_ariquizstatistics S_DEGREE
ON SI.StatisticsInfoId = S_DEGREE.StatisticsInfoId
LEFT JOIN jos_ariquizquestionversion QV_DEGREE
ON S_DEGREE.QuestionVersionId = QV_DEGREE.QuestionVersionId
WHERE
SI.QuizId = QUIZ_ID
AND
SI.Status = "Finished"
AND
S_NAME.QuestionId = 430
AND
S_CITY.QuestionId = 431
AND
S_DEGREE.QuestionId = 432
|
QUIZ_ID in "WHERE" clause is ID of quiz.
Regards,
ARI Soft
|
|
|
Last Edit: 2011/02/13 09:51 By admin.
|
|
|