[thelist] selecting above and below ranges in a SQL query [long]
Joshua Olson
joshua at waetech.com
Mon Aug 26 13:10:01 CDT 2002
----- Original Message -----
From: "Jay Blanchard" <jay.blanchard at niicommunications.com>
To: <thelist at lists.evolt.org>
> Howdy gurus!
> mysql> select * from ErlangTest
> -> where erlang_no <= '1.5'
> -> limit 3;
No time for a full blown response, but you may want to try the order by
clause:
SELECT *
FROM ErlangTest
WHERE erlang_no <= '1.5' (Is this really a string???)
ORDER BY erlang_no DESC
LIMIT 3
That will give you the three just before 1.5
Then, union with erlang_no >= '1.5' ORDER BY erlang_no ASC
HTH,
-joshua
More information about the thelist
mailing list