關于數據庫的復合查詢的問題!請救大家!謝謝!

mouse1981 2004-04-05 06:12:18
我在弄一個新聞發布系統,想获取当前新闻的所在位置,也就是让访问者知道自己所在访问哪一大个栏目,那一个小栏目的文章,需要用到多表查询,可是结果出来。请教一下。
sql="select a.title,a.classid,a.nclassid,c.class,n.nclass from news a inner join (nclass n inner join class c on n.classid=c.classid) on a.nclassid=n.nclassid where a.id="&news_id
请问一下这样写有没有错误呀?我在运行的时候老是提示“Microsoft JET Database Engine 错误 '80040e14'

语法错误 (操作符丢失) 在查询表达式 'a.id=' 中。”
我觉得其它是没有错误的,我只是想知道这个写法有没有错误?
...全文
46 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
mouse1981 2004-04-05
  • 打赏
  • 举报
回复
不是太明白,可不可以说得清楚一点,就是先从新闻表NEWS取出a.title,a.classid,a.nclassid,然后再从NCLASS取出相关的NCLASSID,再从CLASS取出CLASSID,应该可以按上面的来实现吧?
anddytang 2004-04-05
  • 打赏
  • 举报
回复
sql="select a.title,a.classid,a.nclassid,c.class,n.nclass from news a ,nclass n , lass c where n.classid=c.classid and a.nclassid=n.nclassid and a.id="&news_id
lawdoor 2004-04-05
  • 打赏
  • 举报
回复
建议做一个视图会很方便的
ygghost 2004-04-05
  • 打赏
  • 举报
回复
你这个是什么语法?

2个表的连接还可以用 inner join

对于多表(3个以上)就不要他了,用这个语法

select a.title, b.nclass,c.class from tableA as a, tableB as b, tableC as c where

a.id=b.id and b.id=c.id
mouse1981 2004-04-05
  • 打赏
  • 举报
回复
我自己顶上去,请高手们回答一下啊!

28,391

社区成员

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

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