select s.id sid, s.name sname, t.id tid, t.name tname from student s, teacher t where s.tid = t.id and t.id = #{tid} select * from teacher where id = #{tid} select * from student where tid = #{tid}