同时取出字段最大的值和该字段的记录数

wangbei 2008-09-10 03:25:30
set rs=conn.execute("select max(比赛轮次) as maxlunshu from 个人赛结果")
maxlunshu=rs("maxlunshu")
set rs=conn.execute("select count(比赛轮次) as maxnum from 个人赛结果 where 比赛轮次="&maxlunshu&"")
maxnum=rs("maxnum")
set rs=nothing

这段怎么用一个语句实现,并且同时取出两个值。
...全文
106 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangbei 2008-09-10
  • 打赏
  • 举报
回复
select count(比赛轮次) as maxnum,max(比赛轮次) as maxlunshu from 个人赛结果 where 比赛轮次=(select max(比赛轮次) from 个人赛结果)
这个标准,呵呵。
wangbei 2008-09-10
  • 打赏
  • 举报
回复
刚才拉了个括号,现在好使了,根据2楼的改了一下,成功。

select count(比赛轮次) as maxnum,max(比赛轮次) as maxlunshu from 个人赛结果 where 比赛轮次=(select max(比赛轮次) as maxlunshu from 个人赛结果)
不耐烦 2008-09-10
  • 打赏
  • 举报
回复
关注下
wangbei 2008-09-10
  • 打赏
  • 举报
回复
'个人赛结果' 附近有语法错误。
jhwcd 2008-09-10
  • 打赏
  • 举报
回复
select count(比赛轮次) as maxnum from 个人赛结果 where 比赛轮次=(select max(比赛轮次) from 个人赛结果)
lingyun410 2008-09-10
  • 打赏
  • 举报
回复
这两个语句的都是使用同一个执行条件的么?

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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