Friday, December 14, 2007

How to get the minimum value in the same column?

How to get the minimum value in the same column?


You can get the minimum value in the same column on the table.

The ASP codes are written and described as below:



<%

Set conn = Server.CreateObject("Adodb.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

Set rs = Server.CreateObject("Adodb.Recordset")

strSQL ="SELECT Min(Price) As MinPrice FROM Stock;" 'Select a single record that is lowest price in the stock.

rs.Open strSQL,conn,1,3

If Not rs.EOF Then

Response.Write("The lowest price in the Stock is " & rs.fields("MinPrice") & "
")

End If

rs.Close

Set rs = Nothing

%>


No comments: