How To Get Max Number In A Column?
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 M
Solution 1:
You can do something like this to get the top X
from your query and then output them accordingly
<cfqueryname="maxQuery">
SELECT TOP 2 points
FROM table_a
ORDER BY points DESC
</cfquery><cfoutputquery="maxQuery">
#maxQuery.currentRow# - #maxQuery.points#<br></cfoutput>
Solution 2:
you can do like below
selectmax(points) from TABLE_A
for getting second max number you can do like below
selectmax(point) as secondmax from TABLE_A where point<(selectmax(point) from TABLE_A)
Solution 3:
sql have a max and min function to get the maximum and minimum values for a column.You can use max function to get it like below.
selectmax(point) from TABLE_A
Post a Comment for "How To Get Max Number In A Column?"