sybase有多个left join 和多个union会报错
报错内容:
Adaptive Server cannot perform the requested action because column
'organId' is not within the scope of the joined table expression.Check
your command for missing or incorrect database objects,variable names,
and/or input data.
select ...
from
t1
left join
t2
on t1=t2
left join
(
select ... from t3
union all
select ... from t4
)t5
on t1=t5
这样写会报错。
原因 :Hi, it was a limatation of Sybase in the end when using ANSI sql or at least thats what the DBA's told me. A derived table is seen as an inline view in the SQL BO generates, Sybase can handle that but if the inline view contains a union (so your derived table has a union) and there are 3 or more other tables joined with the SQL it throws this error, works fine if only two tables, or if you break the union up into two derived tables. In the end I created the view on the db. I find Sybase frustrating no decode no MINUS commands
Thanks
(出自:http://www.forumtopics.com/busobj/viewtopic.php?p=442226)
解决方法:t1和t2联合,t1和t5联合,t5是一个union这样会报错。把t1和t2先联合之后在于t5联合
select t1.* from
(select ...
from
t1
left join
t2
on ...
) t6
left join
(
select ... from t3
union all
select ... from t4
)t5
on t6=t5
>更多相关文章
首页推荐
佛山市东联科技有限公司一直秉承“一切以用户价值为依归
- 01-11全球最受赞誉公司揭晓:苹果连续九年第一
- 12-09罗伯特·莫里斯:让黑客真正变黑
- 12-09谁闯入了中国网络?揭秘美国绝密黑客小组TA
- 12-09警示:iOS6 惊现“闪退”BUG
- 12-05亚马逊推出新一代基础模型 任意模态生成大模
- 12-05OpenAI拓展欧洲业务 将在苏黎世设立办公室
- 12-05微软质疑美国联邦贸易委员会泄露信息 督促其
- 12-05联交所取消宝宝树上市地位 宝宝树:不会对公
- 12-04企业微信致歉:文档打开异常已完成修复
相关文章
24小时热门资讯
24小时回复排行
热门推荐
最新资讯
操作系统
黑客防御