g
Printer Friendly Version

editor  
BellaOnline's ASP Editor
 

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.

ASP Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 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.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2023 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor