Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How get maximum value in the table.
i need find, who have max total in the termtest table. im using vb.net and sql server. pls help me. thanks
Posted
Updated 19-Mar-12 5:10am
v2

In sql server:

select max(column_name) from table_name


Ex:
select max(total) from termtest
 
Share this answer
 
v2
In case if you want to find the maximum values from the DataTable, then the following code can be used, in which termtest is DataTable, total is the Column of data type Decimal

VB
Dim RowsInDescending As DataRow() = termtest.select("", "total DESC", System.Data.DataViewRowState.CurrentRows)
Dim MaxTotal As Decimal
If RowsInDescending.Length > 0 Then
    MaxTotal = CDec(RowsInDescending(0).Item("total"))
End If
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900