在ColdFusion中使用QoQ按长度排序查询对象中的列?(order a column in a query object by length with QoQ in ColdFusion?)

是否可以使用ColdFusion中的查询查询按varchar列的长度对查询对象进行排序?

Is it possible to sort a query object by the length of a varchar column using Query of Queries in ColdFusion?

最满意答案

没有办法完全使用QoQ,no: QoQ实现不提供len()函数。 相反,您可以让数据库为您提供长度数据。

在原始查询中添加:

len(fieldYouNed) as fieldYouNedLen

在QoQ然后使用:

SELECT * FROM query ORDER BY fieldYouNedLen

There is no way to do this entirely with QoQ, no: the QoQ implementation does not provide a len() function. Instead, you could get the database to provide the length data for you.

In the original query add:

len(fieldYouNed) as fieldYouNedLen

In the QoQ then use:

SELECT * FROM query ORDER BY fieldYouNedLen

更多推荐