思归等高手,可以解决么-如何对union后的结果排序呢?

xatop 2003-10-20 03:49:33
sql="select * from (select id,clss,title,timein from t1 union all select id,clss,title,timein from t2 where rootcl=8) a order by timein desc"

错误!!!!!!!!!!
服务器: 消息 8626,级别 16,状态 1,行 1
在工作表中只允许有 text 指针,而决不允许有 text、ntext 或 image 列。

sql="select id,clss,title,timein from t1 union all select id,clss,title,timein from t2 where rootcl=8 order by timein desc"

错误!!!!!!!!!!
服务器: 消息 8626,级别 16,状态 1,行 1
在工作表中只允许有 text 指针,而决不允许有 text、ntext 或 image 列。


请问怎么解决呢??????????????????
...全文
61 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xatop 2003-10-21
  • 打赏
  • 举报
回复
放弃此贴!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
xatop 2003-10-21
  • 打赏
  • 举报
回复
看来是没有高手了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
xatop 2003-10-20
  • 打赏
  • 举报
回复
我就是在查询分析器里面执行的出现错误提示。头晕。
tailzhou 2003-10-20
  • 打赏
  • 举报
回复
SELECT *
FROM (SELECT *
FROM test
UNION ALL
SELECT *
FROM test) DERIVEDTBL
ORDER BY ddd DESC

ddd:datetime,test包含有image,text,ntext类型字段,在查询分析器测试正常,
你在查询分析器执行也出错?
xatop 2003-10-20
  • 打赏
  • 举报
回复
不是,是nvarchar的,我不按照title排序也不可以么?
yujohny 2003-10-20
  • 打赏
  • 举报
回复
select * from (select id,clss,title,timein from t1 union all select id,clss,title,timein from t2 where rootcl=8) a order by timein desc

那我想你的title字段肯定是text、ntext 或 image 类型了
排序不支持这些字段哦
xatop 2003-10-20
  • 打赏
  • 举报
回复
timein是时间
yujohny 2003-10-20
  • 打赏
  • 举报
回复
你timein是什么类型的?
yujohny 2003-10-20
  • 打赏
  • 举报
回复
这句有什么错误,我看语法没问题啊

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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