Re: Nested SQL query problem...

From: Date: Thu, 30 May 2002 16:20:51 +0000
Subject: Re: Nested SQL query problem...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19522@lists.php.net to get a copy of this message
"Srinivasan Ramakrishnan" <cheeni@six2sixty.com> wrote in message news:004701c206df$5a00f100$4b7fa8c0@lib.ma.us... > The slabs do not continue for an infinite number, hence I may only have slab > pricing for 1-10, 11-100, and 101-200 with the assumption that if there are > no higher slabs and I wanted say the rate for 500 licenses, I would use the > highest slab unit available, in this case the 101-200 slab. ... looking at this, the 'high-limit' value seems redundant (it's always next_highest_minimum - 1); I would suggest getting rid of it, ie Table slabPricing: slabID INT AUTO_INCREMENT productID INT slabStart INT slabRate FLOAT(10,2) > For example, what is the cost of 500 licenses of Product_ID 143 ? SELECT slabRate FROM slabPricing WHERE productID=143 AND slabStart<=500 ORDER BY slabStart DESC LIMIT 1 ... this will retrieve the per-piece rate for the largest applicable slab.

« previous php.db (#19522) next »