MIN - Selecting a Minimum Number in SQL

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.




RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2018 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.