MySQL Forums
Forum List  »  Newbie

Re: EXPLAIN shows optimized query
Posted by: Mahesh Kumar
Date: November 02, 2017 04:02AM

explain SELECT `questions`.`question_id`, `question_multilingual`.`question_text`, `questions`.`FK_quiz_id`, GROUP_CONCAT(choices.choice_id ORDER By choice_multilingual.choice_multilingual_id ASC) as choice_id_array, GROUP_CONCAT(choice_multilingual.choice ORDER By choice_multilingual.choice_multilingual_id ASC) as choice_array FROM `questions` INNER JOIN `question_multilingual` ON `questions`.`question_id` = `question_multilingual`.`FK_question_id` INNER JOIN `choices` ON `questions`.`question_id` = `choices`.`FK_question_id` INNER JOIN `choice_multilingual` ON `choice_multilingual`.`FK_choice_id` = `choices`.`choice_id` WHERE `questions`.`FK_quiz_id` = '1' GROUP BY `questions`.`question_id` ORDER BY RAND()

This explain provides good result.
But if i run the query, i get the questions in english and choices in all the languages, which is not the expected result.

Is there anything wrong in the database design?

Options: ReplyQuote


Subject
Written By
Posted
October 31, 2017 03:11AM
Re: EXPLAIN shows optimized query
November 02, 2017 04:02AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.