select * from tbl_topic where boardId=4 and topicid in ( selecttopicId from tbl_reply order by modifytime desc)
错误提示:消息 1033,级别 15,状态 1,第 1 行
除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。
大牛:你这个语句是个嵌套语句,其中有一个子查询(就是你括号里内容),而在子查询中用ORDERBY是无效的,你想想子查询返回的也是一个集合,排不排序对你的in 来说也没有什么太大的影响。可以把order by 去掉。select * from tbl_topic where boardId=4 and topicid in ( select topicId from tbl_reply )...
select * from tbl_topic where boardId=4 and topicid in ( select topicId from tbl_reply ) order by modifytime desc或select * from tbl_topic where boardId=4 and topicid in ( s...