一个在asp中的sql问题

sealor109 2004-12-06 05:31:35
现在我有一个表:picture_active
有两个字段:id 和 path

在asp中连接数据库查询该表,要得到id的最大值和最小值,并把最大值赋给变量a,最小值赋给变量b,请问在asp中这个语句应该怎么写?
...全文
118 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
谢紫枫 2004-12-07
  • 打赏
  • 举报
回复
刚才忘了写连接字符串了
rs.open "select Max(id) as a,Min(id) as b from picture_active order by id desc",CN,3,3
wq99 2004-12-07
  • 打赏
  • 举报
回复
统一楼上的各位。
楼主是不是第一次在asp里对数据库操作。
^_^ 我也差不多
liuyangxuan 2004-12-07
  • 打赏
  • 举报
回复
。。。。
谢紫枫 2004-12-07
  • 打赏
  • 举报
回复
rs.open "select Max(id) as a,Min(id) as b from picture_active order by id desc",3,3
3,3是参数,控制读写权限等
hqcsx 2004-12-07
  • 打赏
  • 举报
回复
select top1 id from table order by id desc可以获得id的最大值.
aspgreener 2004-12-06
  • 打赏
  • 举报
回复
select a=max(id),b=min(id) from picture_active
sealor109 2004-12-06
  • 打赏
  • 举报
回复
rs.open "select Max(id) a,Min(id) b from picture_active order by id desc",3,3
a=rs("a")
b=rs("b")


3,3是什么意思啊?
ygjwjj 2004-12-06
  • 打赏
  • 举报
回复
rs.open "select Max(id) a,Min(id) b from picture_active order by id desc",3,3
a=rs("a")
b=rs("b")

28,409

社区成员

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

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