select a.*,b.score as EnglishScore,c.score as MathScore from student a 
left join EnglishScore b on a.id=b.stnum 
left join MathScore c on a.id=c.stnum

解决方案 »

  1.   

    SELECT  students.* ,
            EnglishScore.score AS EnglishSroce ,
            MathScore.score AS MathScore
    FROM    students
            JOIN EnglishScore ON EnglishScore.stnum = students.id
            JOIN MathScore ON MathScore.stnum = students.id
    WHERE   students.id = 15001
      

  2.   

    select b.stnum,a.name,b.socre as englishscore,c.score as mathscore 
    from student a left join Englishscore b on a.id=b.stnum --通过student表的id跟englishscore表的stnum连接得出每个学生的英语成绩
    left join mathsocre c on a.id=c.stnum    --通过student表的id跟mathscore表的stnum连接得出每个学生的数学成绩
    where a.id=1看看join语法就会明白了
    http://www.w3school.com.cn/sql/sql_join.asp
      

  3.   

    结帖率:0%
       
    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://bbs.csdn.net/help#post_dispose
      

  4.   

    select EnglishScore.strNum,students.name,EnglishScore.score as EnglishScore,MathScore.score as MathScore
     from students,EnglishScore,MathScore
    where students.id=15001 and MathScore.strnum=15001 and English.strnum=15001