select * from channel where ParentID=(select ParentID from Channel where classname ='"&Class_news&"' order by classid asc) order by ClassID
--------------------------------------------------------------------
报错:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]除非同时指定了 TOP,否则 ORDER BY 子句在视图、内嵌函数、派生表和子查询中无效。
---------------------------------------------------------------------
多谢各位了
--------------------------------------------------------------------
报错:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]除非同时指定了 TOP,否则 ORDER BY 子句在视图、内嵌函数、派生表和子查询中无效。
---------------------------------------------------------------------
多谢各位了
子查询的order by 去掉。或者在前面加上"top 数值"
select * from channel where ParentID=(select top 1 ParentID from Channel where classname ='"&Class_news&"' order by classid asc) order by ClassID
或
select * from channel where ParentID=(select top 1 ParentID from Channel where classname ='"&Class_news&"' order by classid asc) order by ClassID
另外,如果“select top 1 ParentID from Channel where classname ='"&Class_news&"' order by classid asc”它的结果是多个的话,where ParentID=等号需要变为“in”