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:
\n id |product_id |count_from |count_to |discount \n 1|8 |0 |30 |22 \n 2|8 |31 |60 |12 \n
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
SELECT *
FROM discounts
WHERE 27 BETWEEN count_from AND count_to
SELECT *
FROM discounts
WHERE 33 BETWEEN count_from AND count_to
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.