-
how to avoid duplicate data in php mysql ?
over 8 years ago
-
over 8 years ago
Use GROUP_CONCAT and CONCAT
The query should be like this :
print("SELECT q.*, (SELECT GROUP_CONCAT(concat(a.choices, ':', a.is_correct) SEPARATOR ',') FROM answers a WHERE q.question_number = a.question_number) AS all_choices FROM questions q");
For output of this query, see screen shot
-
1 Answer(s)