Sprit000
2013-11-14 16:48 阅读 174

求SQL语句

[img]http://dl.iteye.com/upload/picture/pic/128405/2af54070-97c9-3846-84ca-c2521ba3ab23.png[/img]

student表中数据如图:

求每个班级中年龄最小的学生的姓名

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

7条回答 默认 最新

  • 已采纳
    illiqiang javahahahne 2013-11-15 09:12

    select 班级,姓名 from student where 生日 in(select max(s.生日) from student s group by s.班级 )

    点赞 评论 复制链接分享
  • jinnianshilongnian jinnianshilongnian 2013-11-14 17:25

    select 班级,max(生日) from tbl group by 班级

    点赞 评论 复制链接分享
  • iteye_14920 iteye_14920 2013-11-15 15:36

    select '班级','姓名' from student t1 where not exists (select * from student t2 where t1.'生日'<t2.'生日' )

    点赞 评论 复制链接分享
  • shui878412 蜗牛_snail 2013-11-15 17:30

    如果支持ROW_NUMBER() OVER的话我会用ROW_NUMBER() OVER,效率比较高

    其具体用法参见http://www.cnblogs.com/fxgachiever/archive/2010/09/15/1826792.html

    点赞 评论 复制链接分享
  • mr_von1024 夏天飘过的风 2013-11-15 20:56

    select 生日 from table group by 班级 order by 生日 asc

    点赞 评论 复制链接分享
  • xqg_5083 xqg_5083 2013-11-16 19:45

    [size=medium]student(id ,name, birth,class)

    select a.name from
    stutdnet a, (select max(brith) birth , class from student group by class) b
    where a.birth = b.birth and a.class = b.class[/size][size=medium][/size]

    点赞 评论 复制链接分享
  • xqg_5083 xqg_5083 2013-11-16 19:46

    student(id ,name, birth,class)

    select a.name from
    stutdnet a, (select max(brith) birth , class from student group by class) b
    where a.birth = b.birth and a.class = b.class

    点赞 评论 复制链接分享

相关推荐