由于某些原因,当我在findAll()的order子句中指定“随机”时,CFWHeels抛出一个错误:
Wheels.ColumnNotFound Wheels查找映射到随机属性的列,但在数据库表中找不到它。建议的行动 验证order参数和/或属性到列映射,这些映射是在模型的init方法中使用属性方法完成的,以确保一切都是正确的。
我以前使用过计算的属性,但是这不应该在“随机”排序方面寻找其中的任何一个。
<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语句有关吗?
会很感激你的帮助。
非常感谢迈克尔。
发布于 2013-01-24 17:47:10
如评语中所确立的那样。
如果order by rand()在mySQL中工作,我首先要尝试的是轮子函数中的order = 'rand()'。
https://stackoverflow.com/questions/14505313
复制相似问题