Hello,

been trying to figure out the correct SQL query to get percentage from a table that list a Min, and Max., price range and the percentage associated to the range.

Here is the current data in the table:
1 0.00 4999.00 13.0
2 5000.00 9999.00 12.5
3 10000.00 14999.00 12.0
4 15000.00 19999.00 11.0
5 20000.00 99999.00 10.0

Table structure:
commisid smallint(3) NOT NULL auto_increment,
min decimal(6,2) NOT NULL default '0.00',
max decimal(6,2) NOT NULL default '0.00',
percentage decimal(2,1) NOT NULL default '0.0',
PRIMARY KEY  (commisid)

So if I wanted to get the percentage for a price of 500.00 I would like to query the data to find where the 500.00 is equal or greater then the 'min' and less or equal to the 'max' giving me the percentage value.

I have tried 'select percentage from table_name where
              min >= 500.00 and max <= max;

but that renders no results.... is there a query to accomplish this or should I setup my table structure differently. ??

TIA

--
Mike<mickalo>Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Quality Web Hosting
http://www.justlightening.net
MSN: [EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to