SELECT percentage FROM table_name WHERE min <= 500.00 AND max >= 500.00
Michael
Mike Blezien wrote:
Sorry..
The query should be: select percentage from table_name where min >= 500.00 and 500.00 <= max;
database.
-------- Original Message -------- Subject: Query Range Date: Mon, 08 Dec 2003 11:23:28 -0600 From: Mike Blezien <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Organization: Thunder Rain Internet Publishing To: MySQL List <[EMAIL PROTECTED]>
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
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]