如何获取列中的最大数? [英] How to get max number in a column?
本文介绍了如何获取列中的最大数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在试图找到一个例子,说明如何在列中获取最大数。我想要做的是找到TABLE_A中的一个列的最大数量,points(column)。我想输出此MAX数字,例如
< cfoutput>
< tr>
< th>< div align =right>#maxnumber#< / div>< / th>
< / tr>
< / cfoutput>
不知道这是输出的方式,但我只想要一个数字
解决方案
感谢您对ColdFusion的支持。 / div>
您可以这样做,从您的查询中获取最顶层的 X
,然后相应地输出
< cfquery name =maxQuery>
SELECT TOP 2 points
FROM table_a
ORDER BY points DESC
< / cfquery>
< cfoutput query =maxQuery>
#maxQuery.currentRow# - #maxQuery.points#< br>
< / cfoutput>
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>
Not sure if this is the way to output, But I just want one number(the MAX) , not an array of the column.
thanks for your help, new to ColdFusion.
解决方案
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屋!
查看全文