I have a litle bit problem to show the employees name with their academic title / degree. here is i attached the table :
for example, i want to show the employees name like this : "Dr. Christ Smailling, BSc., M.Eng.".
I have a litle bit problem to show the employees name with their academic title / degree. here is i attached the table :
for example, i want to show the employees name like this : "Dr. Christ Smailling, BSc., M.Eng.".
You could use group_concat
to concatenate all the relevant titles a person has and then concat_ws
to join everything together:
SELECT CONCAT_WS(GROUP_CONCAT(fat ORDER BY dh.id SEPARATOR ', '),
e.name,
GROUP_CONCAT(bat ORDER BY dh.id SEPARATOR ', '))
FROM employee e
JOIN degree_history dh ON e.id = dh.employee_id
GROUP BY e.name