分析一个复杂的sql语句:select

zhangvi111 2004-11-26 03:34:33
set rs=conn.execute("select *,(select count(*) from tree where pid = T.id) as children,(select pid from tree where id="&id&") as parent from tree T where pid="&id)
这个语句我看不懂,请大虾指点。也可以给我推荐一个学习sql的网站。
...全文
119 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
timdy 2004-11-26
  • 打赏
  • 举报
回复
相当于

select *, a , b from tree T where pid="&id

也是这样的:
搜索表tree
条件:字段pid=你的参数id
返回:1、*
2、select count(*) from tree where pid = tree.id(字段)
3、select pid from tree where id(字段)=id(参数)

flying_flower 2004-11-26
  • 打赏
  • 举报
回复
搜索表tree
条件:字段pid=你的参数id
返回:1、*
2、select count(*) from tree where pid = tree.id(字段)
3、select pid from tree where id(字段)=id(参数)
wanghongtaoleifeng 2004-11-26
  • 打赏
  • 举报
回复
兔子说的好 解释的很好 牛啊
tufun 2004-11-26
  • 打赏
  • 举报
回复
as 后是自己定义的别名
ouyangyc 2004-11-26
  • 打赏
  • 举报
回复
高程考试这几年都有这样的SQL语句
建义看看这方面例题
  • 打赏
  • 举报
回复
关键是你没懂select后面写的东东
其实可以参考http://access911.net
select count(*) from tree where pid = T.id我想这句你应该没什么问题,我记得上高一的时候我的数学老师说过一句话,代数就是要代换的,其实这里你也可以这么想的
as children把刚才的count带换了得到一个数量
这样一简化其实就是select *,children,parent from tree T where pid=id当然children和parent不是真实存在的而是通过语言给虚构出来的
redstorm11 2004-11-26
  • 打赏
  • 举报
回复
www.baidu.com
life360 2004-11-26
  • 打赏
  • 举报
回复
相当于

select *, a , b from tree T where pid="&id




28,409

社区成员

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

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