I need a way to check if a number is in the bottom three of a column in
my database. For example, if I had a list of number in my table like this:
1
5
8
12
60
1
10001
I might need to know if 5 was in the bottom three, which it would be.
But if I checked 60, it wouldn't be. I could check
PROTECTED]]
Sent: Monday, December 23, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checking if number is in bottom three?
I need a way to check if a number is in the bottom three of a column in
my database. For example, if I had a list of number in my table like this:
1
5
8
12
60
1
10001
Generally, you want to use the LIMIT function.
SELECT num FROM myfile ORDER BY num LIMIT 3;
However, if the values may be repeated (e.g., 1,1,1,2,4,4,5), the query
above will return 1,1,1.
If you are interested in the three lowest values and not just smallest
entries, add DISTINCT
SELECT