[SlugBug] MYSQL query help
Alan Dawson
aland at burngreave.net
Wed Sep 6 16:03:16 BST 2006
Quoting Alan Dawson <aland at burngreave.net>:
> I have a query
>
> SELECT mdl_question_answers.id,mdl_question_answers.question FROM
> mdl_question_answers,mdl_question WHERE mdl_question.qtype='multichoice' AND
> mdl_question_answers.question=mdl_question.id
>
..
>
> but i want it like this
>
> 39,40,41,42,43 11
> 54,55,56,57 37
> 58,59,60,61 38
> 62,63,64,65 39
>
> I can then use these lines to create some INSERT's into another table
>
>
SELECT GROUP_CONCAT(mdl_question_answers.id),
mdl_question_answers.question FROM
mdl_question_answers,mdl_question WHERE
mdl_question.qtype='multichoice' AND
mdl_question_answers.question=mdl_question.id
GROUP BY mdl_question_answers.question;
did the trick .. thanks ;-)
AED
--
"If you make decisions about software -- or anything -- based solely on
short-term cost and benefit, someone with a longer view can easily
manoeuver you into a trap from which it is hard to escape."
More information about the SlugBug
mailing list