Home > Software design >  MySQL : How to I, join this table?
MySQL : How to I, join this table?

Time:02-27

I have table like this, and i want to output the result like output table, can anyone tell me how to do it, in MySQL

enter image description here

CodePudding user response:

Good morning, you can use LEFT JOIN

try it:

SELECT tb_session.SESSION, tb_schedul.ID_CLASS FROM tb_session LEFT JOIN tb_schedul
ON tb_session.ID = tb_schedul.ID_SESSION;

CodePudding user response:

You can use left join like so :

SELECT tb_session.SESSION AS SESSION, tb_class.CLASS AS CLASS from tb_schedul LEFT JOIN tb_session ON tb_schedule.ID_SESSION = tb_session.ID LEFT JOIN tb_schedul.ID_CLASS = tb_class.ID
  • Related