Welcome to my ASP Code Website

MIN - Selecting a Minimum Number in SQL

The MIN function in SQL is much like the MAX function. Where the MAX function gives you the highest number found in a given field, the MIN gives you the smallest number.

Let's say you were running a sale on soap products and you wanted to automatically have the system promote whatever your cheapest item was on the front page, without having to recode the front page every time you changed your price list. You could do

Select MIN(soap_price) as MinPrice from soaps

and then use a

response.write "Our soaps are available from only " & objRec3("MinPrice") & "!!"

as the tag line on your site homepage.

The min function can get you the lowest price, the smallest gear size you support, and any other numeric value.

SQL Command Listing