Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have a table like below and I want to find the range of inputted number. ex) if users enters 84, MySql query returns B.
Rank Range_Start Range_End A 90 100 B 80 89 C 70 79 . . H I 0 10
What about:
SELECT Rank FROM tbl WHERE Range_Start < my_value AND Range_End > my_value
Or (if you don't need strict inclusion):
SELECT Rank FROM tbl WHERE my_value BETWEEN Range_Start AND Range_End