当前位置:数据库 > SQLServer >>

问大家一个MSSQL数据库多表联合查询的问题?

conn.execute "select top "&top&" T_SmallCategory.F_value,t_article.F_title,t_article.F_id,t_article.F_filepath,t_article.F_addtime from T_SmallCategory inner join t_article where t_article.T_SmallCategoryid=T_SmallCategory.F_ID order by t_article.F_id desc" 为什么老是报错。还有就是这种方式查出来怎么显示? response.write()这个应该怎么写呢?
补充:程序执行的页面错误提示是:  [Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'where' 附近有语法错误。 
我把where改成了on 可是还是会出错,那位大哥能不能再详细点啊?我是新手!
 Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21' 
ODBC 驱动程序不支持所需的属性。
答案:inner join后面是跟on,不是跟where
即"from T_SmallCategory inner join t_article on t_article.T_SmallCategoryid=T_SmallCategory.F_ID" 

查出来的结果,应该建一个dataset,然后对dataset里面每个记录循环调用response.write。可以参考:http://zhidao.zzzyk.com/question/94358180.html?fr=qrl 

能把出错信息告诉我么。 

把 top "&top&" 去掉看看能不能运行。
其他:你用了inner join 两表连接但是没有写连接字段。 

上一个:MSSQL触发器,帮忙写个~
下一个:MSSQL 使用INSERT INTO疑问

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,