ORMExecuteQuery()计数似乎返回一个数组

ORMExecuteQuery()计数似乎返回一个数组,orm,coldfusion,Orm,Coldfusion,ORMExecuteQuery()似乎为以下项返回一个数组 example = ormExecuteQuery("select count(commentID) as n from pComment c"); output uing cfdump for example would be... array [1][x] 其中x是计数 我怎样才能得到n作为一个数字而不是返回的数组对象?我只想使用getn()试试这个: example = ormExecuteQuery("select coun

ORMExecuteQuery()似乎为以下项返回一个数组

example = ormExecuteQuery("select count(commentID) as n from pComment c");

output uing cfdump for example would be...
array
[1][x]
其中x是计数

我怎样才能得到n作为一个数字而不是返回的数组对象?我只想使用getn()

试试这个:

example = ormExecuteQuery("select count(commentID) as n from pComment c", true);

第二个参数被称为
unique
,尽管它的名称令人困惑,但它完全符合您的需要:使函数返回单个值。

ColdFusion文档可能非常可怕。这里有一个明确的消息来源说:很好的发现,@Sergii。