取最大值

yz727272 2011-06-18 10:56:19

字段AA BB cc



aa bb cc

李小姐 苹果 55
李小姐 香蕉 120




求李小姐吃哪种水果最多。


...全文
49 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
叶子 2011-06-18
  • 打赏
  • 举报
回复

select top 1 * from tb where aa='李小姐' order by cc desc
AcHerat 元老 2011-06-18
  • 打赏
  • 举报
回复

select *
from tb t
where not exists (select 1 from tb where aa = t.aa and cc > t.cc)
GoAwayZ 2011-06-18
  • 打赏
  • 举报
回复
select top 1 * from tb where aa='李小姐' order by cc desc
xuexiaodong2009 2011-06-18
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 maco_wang 的回复:]

SQL code

select top 1 * from tb where aa='李小姐' order by cc desc
[/Quote]可以

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧