Reputation: 65
I'm learning about MySQL and I have a case, I have some table like this:
id, level, minpost, maxpost
1, 'Newbie', 0, 99
2, 'Enthusiast', 100, 499
3, 'Activist', 500, 749
4, 'Socialite', 750, 999
So how do I know which "level" if I have 80 posts?
Should I use select between or maybe you have any suggest for my problem?
ps. I cant post image :(
Upvotes: 0
Views: 1020
Reputation: 59660
Yes you can use BETWEEN.
It's nothing but the short form of value>=minvalue AND value<=maxvalue
The query will look like:
select * from `tableName`
where <valueToCheck> between minpost AND maxpost;
Upvotes: 0
Reputation: 694
select id,level from <table> where minpost >= <minpost> and maxpost <= <maxpost>
Upvotes: 0
Reputation:
select *
from the_table
where 80 between minpost AND maxpost
P.S.: don't bother posting images, SQL code (that can be copied) is much better
Upvotes: 0