在一个表中使用另外一个表的字段去排序,这个SQL语句有什么不对?

seav 2009-06-02 07:28:07
select id,title,keywords,hits,intro,adddate,author,(select count(id) from 表2 where 表2.infoid=表1.id) as commenttotal from 表1 where 表1.deltf=0 and 表1.verific=1 order by commenttotal desc

以上语句在Access运行查询时总时提示"输入参数值commenttotal"
但如果不按commenttotal进行排序就不会出现.
...全文
53 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lbcleo 2009-06-02
  • 打赏
  • 举报
回复
up
地方有误
lihan6415151528 2009-06-02
  • 打赏
  • 举报
回复
这样
select id,title,keywords,hits,intro,adddate,author,(select count(id) from 表2 where 表2.infoid=表1.id) as commenttotal from  表1 where  表1.deltf=0 and 表1.verific=1 order by (select count(id) from 表2 where 表2.infoid=表1.id)desc 
seav 2009-06-02
  • 打赏
  • 举报
回复
lihan6415151528

您的方法在Access里提示 order by 后面的语句出错,是不是在access里不支持?

28,391

社区成员

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

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