如何获得列中的最大数量? [英] How to get max number in a column?

查看:39
本文介绍了如何获得列中的最大数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试查找如何在列中获取最大数量的示例.我想要做的是,在 TABLE_A 中找到一列的最大数量,点(列).例如,我想输出这个 MAX 数

I'm been trying to find a example of how to get a max number in a column.What I want to do is, find the MAX number of a column in a TABLE_A, points(column). I want to output this MAX number for example

<cfoutput>
    <tr>
    <th><div align="right">#maxnumber#</div></th>
    </tr>
    </cfoutput>

不确定这是否是输出方式,但我只想要一个数字(MAX),而不是列的数组.

Not sure if this is the way to output, But I just want one number(the MAX) , not an array of the column.

感谢您的帮助,ColdFusion 新手.

thanks for your help, new to ColdFusion.

推荐答案

你可以做这样的事情来从你的查询中获取顶部的 X,然后相应地输出它们

You can do something like this to get the top X from your query and then output them accordingly

<cfquery name="maxQuery">
SELECT TOP 2 points
FROM table_a
ORDER BY points DESC
</cfquery>

<cfoutput query="maxQuery">
  #maxQuery.currentRow# - #maxQuery.points#<br>
</cfoutput>

这篇关于如何获得列中的最大数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆