在我的代码中,我首先创建了查询对象:
<cfset memberData = QueryNew('slug,pos,firstname,lastname,email') />
<cfset temp = QueryAddRow(memberData, #numMembers#) />
<!--- LOOP POPULATES QUERY OBJECT --->
<cfloop...</cfloop>
然后,我可以通过运行以下命令(按预期输出)来验证它是否已被填充:
<cfoutput query="memberData">
#slug# - #pos#<br>
</cfoutput>
然后我尝试查询 memberData 查询对象,一切都变得松散了。如果我运行:
<cfquery name="members" dbtype="query">
SELECT slug,pos,firstname,lastname
FROM memberData
WHERE slug = #slug#
</cfquery>
我收到此错误:
Query Of Queries runtime error.
The select column reference [university] is not a column in any of the tables of the FROM table list.
在上面提到的输出测试中,我可以验证“大学”是 slug 列中的值之一。显然我在我的方法中遗漏了一些东西,但我对它可能是什么感到困惑。任何帮助将不胜感激!
最佳答案
Query Of Queries runtime error.
The select column reference [university] is not a column in any of the tables of the FROM table list
您的错误 是 由 where 子句中没有引号引起的 仅此而已 :
此表达式查找 slug 列中的值等于 CF slug 变量(字符串)中的值的行:
WHERE slug = '#slug#'
另一方面,此表达式意味着查找 slug 列中的值等于 CF slug 变量(字符串)中命名的列中包含的值的行:
WHERE slug = #slug#
您需要更改为
SELECT *
的最可能原因是 CF 查询缓存。所以现在改回来应该可以解决问题。 和始终使用 <cfqueryparam .../>
正如“Al Everett”所建议的那样
关于coldfusion - CF QoQ 抛出运行时错误。 "Column reference is not a column in any of the tables of the FROM table list.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12382961/