Q行为Q不一致 [英] Inconsistent Q of Q Behaviour
问题描述
使用ColdFusion Server Enterprise 9,0,1,274733。
Using ColdFusion Server Enterprise 9,0,1,274733.
以前有人看过这个吗?以下代码无错执行。
Has anyone seen this before? The following code executes without error.
<cfquery name="x" datasource="dw">
select event_code, event_name
from event
</cfquery>
<cfquery name="y" dbtype="query">
select event_code || event_name fred
, event_code
from x
</cfquery>
需要注意的两件事情是我声明了别名而不使用关键字as ||串联字符串。但是,如果我符合第一个事件代码,如下:
Two things to notice are that I declared an alias without using the keyword "as", and I used || to concatenate strings. However, if I qualify the first event code, like this:
<cfquery name="y" dbtype="query">
select x.event_code || event_name fred
, event_code
from x
</cfquery>
我获得
查询查询语法错误。
遇到。选择列表不正确,选择列不正确,x.event_code后面不能跟'||'
Encountered ". Incorrect Select List, Incorrect select column, x.event_code cannot be followed by '||'
如果我试图声明一个没有关键字as的别名,也有类似的错误。
There is a similar error if I attempt to declare an alias without the keyword "as".
,我可以弄清楚该怎么做,但是我很好奇,如果你在第10版上发生了同样的事情。
For the task at hand, I can figure out what to do, but I'm curious if the same thing happens to those of you on Version 10?
strong>
Edit starts here
阅读评论后,我尝试了括号,运行没有错误。
After reading the comments, I tried parentheses. This runs without error.
<cfquery name="y" dbtype="query">
select (x.event_code || event_name) fred
, event_code
from x
</cfquery>
推荐答案
()
以使其正常工作
SELECT (x.event_code || event_name) fred
这篇关于Q行为Q不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!