I have a discount lookup table like this:
days | discount |
---|---|
3 | 5.00 |
7 | 10.00 |
10 | 15.00 |
Basically the tiered discount lookup works like this:
If the passed-in days number is 5, then the query should return 10.00.
How can I write a CodeIgniter query to perform this logic?
SELECT discount FROM mytable WHERE days > XXXX LIMIT 1
where XXX is the number of days you want.