I have the below query:
select m.name, m.surname,m.teacher, c.classroom,c.floor from table1 as m inner join table2 as c on (m.name=c.name or m.surname = c.su