如二个表:
Student字段:
id
name 
techer(外键)
Techer字段:
id(主键)
name用Techer的id找出某一老师name和所负责学生name

解决方案 »

  1.   

    本帖最后由 bdmh 于 2013-03-14 11:18:04 编辑
      

  2.   

    select 
    stu.name as stuname,
    tea.name as teaname
    from teacher as tea
    inner join student as stu 
    on tea.id = stu.techer
    where tea.id = @id
      

  3.   

    select A.Name as teachername,B.Name as studentname from teacher A,student B where A.id=B.id andA.id=xxxxx
      

  4.   

    select
    Student.name
    Teacher.name
    from Teacher,Student
    where 
    Teacher.id=Student.teacher
    and
    Teacher.id=***