Answer the question
In order to leave comments, you need to log in
Query to the database displaying common values for different id?
Good afternoon.
There is a table: t_s (id, teacherid, studentid) I execute
a query on it:
SELECT teacherid, studentid, GROUP_CONCAT(studentid ORDER BY studentid ASC SEPARATOR ', ') FROM t_s GROUP BY teacherid
Answer the question
In order to leave comments, you need to log in
The request does not need to be changed, and it will not work to do the one you write about. It is necessary to process the output of the request using PHP. Drive the output of the query into a multidimensional array, and use the foreach loop to search line by line for the presence of the same students in other lines, and then display them on one line. Something like this ... well, that's what I would do ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question