huang3231423
huang3231423
2015-08-27 14:36
采纳率: 100%
浏览 1.4k

求一条sql语句,单表查询的

表结构 (姓名,课程,成绩) 现在求获的该表总成绩最高学员的名字

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

9条回答 默认 最新

  • strutce
    丵鹰 2015-08-27 14:54
    已采纳

    mysql 数据库select sum(成绩) as t from table group by 姓名 order by t limit 0,1
    oracle数据库 select * from (select sum(成绩) as t from table group by 姓名 order by t) WHERE ROWNUM<=1
    sqlserver数据库 select top 1 sum(成绩) as t from table group by 姓名 order by t

    点赞 评论
  • caozhy

    select top 1 sum(成绩) as t from table group by 姓名 order by t

    点赞 评论
  • havedream_one
    havedream_one 2015-08-27 14:45

    select sum(score) as s from table group by name order by s limit 1

    点赞 评论
  • jj801238
    jj812388 2015-08-27 14:50

    select top 1 Name from TableName order by Grade desc;
    或者
    select Name from TableName order by Grade limit 1;

    点赞 评论
  • tabe123
    霓为衣兮风为裳 2015-08-27 15:13

    select top 1 Name from TableName order by Grade desc

    点赞 评论
  • cuiwei1026522829
    另一花生 2015-08-27 15:34

    select top 1 sum(成绩) as t from table group by 姓名 order by t

    点赞 评论
  • u011857683
    路痴的旅行 2015-08-27 16:19

    select sum(score) score1 from 表名 group by 名字 order by score1 desc limit 1;

    点赞 评论
  • huang3231423
    huang3231423 2015-08-27 17:32

    谢谢你们 ,你们太好鸟

    点赞 评论
  • yuke198907
    yuke198907 2015-08-28 00:49

    select top 1 sum(成绩) as t from table group by 姓名 order by t

    点赞 评论

相关推荐