I have a table called discounts
Field Type
id int(11) NOT NULL
resort_id int(11) NOT NULL
count_from int(11) NULL
count_to int(11) NULL
discount varchar(255) NULL
And i have rows like below:
id |product_id |count_from |count_to |discount
1|8 |0 |30 |22
2|8 |31 |60 |12
When i am getting 27 as a input i should retrieve the first row (id:1). Suppose if my input is 33 i should retrieve 2 row(id:2).
How to write a mysql query?
Regards,
Prabhu
1 Answer