access中两个表:
表一名为"学籍信息",包含如下字段:学籍号,编号,姓名
表二名为"111",包含如下字段:编号,姓名,语文,数学,英语
查询意图:将语文,数学,英语单科成绩后二十名都查询出来,追加到一个新表(名为:补考表)中,新表字段,应加上学籍号和姓名.本人纯属新手,工作需要,赶鸭子上架,勿笑.如可能,请贴出完整代码,我一复制即可.

解决方案 »

  1.   

    insert into 补考表(编号,姓名,语文,数学,英语,学籍号)
    select b.编号,b.姓名,b.语文,b.数学,b.英语,a.学籍号
    from 学籍信息 a,[111] b
    where a.编号 = b.编号
    and b.编号 in (select top 20 编号 from [111] order by 语文 )
    union
    select b.编号,b.姓名,b.语文,b.数学,b.英语,a.学籍号
    from 学籍信息 a,[111] b
    where a.编号 = b.编号
    and b.编号 in (select top 20 编号 from [111] order by 数学 )
    union
    select b.编号,b.姓名,b.语文,b.数学,b.英语,a.学籍号
    from 学籍信息 a,[111] b
    where a.编号 = b.编号
    and b.编号 in (select top 20 编号 from [111] order by 英语 )
      

  2.   

    select t.*,学籍信息.学籍号 into 补考表 from (
    select  top 20 * from 111 order by 语文 
    union 
    select  top 20 * from 111 order by 数学 
    union 
    select  top 20 * from 111 order by 英语 
    ) t,学籍信息  where t.编号= 学籍信息.编号 
      

  3.   

    qthwshy (qthwshy)
      '截至2011-10-13 15:40:49  用户结帖率0.00%  当您的问题得到解答后请及时结贴.
    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://community.csdn.net/Help/HelpCenter.htm#结帖