SQL select statement
Posted
by kwokwai
on Stack Overflow
See other posts from Stack Overflow
or by kwokwai
Published on 2010-06-12T07:29:50Z
Indexed on
2010/06/12
7:32 UTC
Read the original article
Hit count: 345
mysql-query
Hi all,
I got a Table which has two fields: Point, and Level,
with some sample data as follows:
-----------------------
Point | Level
-----------------------
10 | Level 1
20 | Level 2
30 | Level 3
40 | Level 4
Suppose that there is a user who has 25 points,
to find the Level in which this user is in, the Select statement I used was:
Select Level from Table where Point < 30 AND Point > 20;
But the Select SQL ststament is a hard-copy one
where you can see the ponts 30 and 20 are fixed.
I want to alter the Select statement so that the new SQL Select
statement can be applied to all users with different points,
but I don't know how to do it.
© Stack Overflow or respective owner