I have a teacher
table and I also have a phone
table where the link is through the person's ID. When I look up the phone numbers of each professor, it appears like this:
(SELECT
T.ID_TEACHER,
P.PHONE,
P.NUMBER
FROM TEACHER T LEFT JOIN PHONES P
ON P.IDPERSON = T.ID_TEACHER)
ID_TEACHER | PHONE | NUMBER |
---|---|---|
1 | 1 | xxxxxxx |
1 | 2 | xxxxxxxx |
1 | 3 | xxxxxxx |
2 | 1 | xxxxxxx |
However, I would like it to be shown like this:
ID_TEACHER | PHONE | NUMBER | PHONE | NUMBER | PHONE | NUMBER |
---|---|---|---|---|---|---|
1 | 1 | xxxxx | 2 | xxxxx | 3 | xxxxx |
2 | 1 | xxxxxxxxx |
How do I do? I'm using MYSQL. I didn't find a solution.