its easier selecting a row whose value is between given number. But I m having no luck to figure out this-
I have a table in which there are two fields min_age
and max_age
. How to return all rows when given value lies between min_age and max_age
P.S. I m still a newbie in sql, please forgive me if this sounds too silly.
Thanks
SELECT *
FROM `tbl`
WHERE 35 BETWEEN `min_age` AND `max_age`;
That ought to do it. Of course, I used 35. You can use any other value instead.
You can use BETWEEN
to get your desired result
SELECT *
FROM tablename
WHERE <some value> BETWEEN `min_age` AND `max_age`;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With