出于某种原因,当我在 findAll() 的顺序子句中指定“随机”时,CFWHeels 抛出错误:
Wheels.ColumnNotFound
Wheels looked for the column mapped to the random property but couldn't find it in the database table. Suggested action
Verify the order argument and/or your property to column mappings done with the property method inside the model's init method to make sure everything is correct.
我以前使用过计算属性,但这不应该是在寻找与“随机”排序有关的任何属性。
<cffunction name="random">
<cfparam name="params.page" default="1" />
<cfparam name="params.pageQuantity" default="5" />
<cfset posts = model("post").findAll(
select = "
posts.postID,
postTitle,
postPoints,
postAuthority,
postCreated,
postCommentCount,
postUpVoteCount,
postDownVoteCount,
users.userID,
userName,
categories.categoryID,
categoryTitle,
categoryToken",
include = "user,category",
order = "random",
page = params.page,
perPage = params.pageQuantity
) />
</cffunction>
这可能与使用 select
语句有关吗?
非常感谢任何帮助。
非常感谢, 迈克尔。
最佳答案
如评论中所述。
如果 order by rand()
在 mySQL 中有效,我首先要尝试的是 wheels 函数中的 order = 'rand()'
。
关于mysql - CFWheels - Order = "random"抛出列错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14505313/