Posted by Gerry Vandermaesen on 04/11/06 13:44
endlesstide@gmail.com wrote:
> how would I
> query the database and request the first 50 records, sorted by
> ascending value?
I'd say a plain simple "SELECT * FROM table ORDER BY number LIMIT 50";
Have the "number field" indexed for optimization. MySQL also optimizes
the LIMIT clausule.
> - and also how would I query the database for a
> certain set of records by Unique ID such as 250 thru 300 --- and see
> those records in ascending order -relative- to the total record set?
Not sure of what you are asking here. This is how you select records
with id from 250 up to 300:
"SELECT * FROM table WHERE id >= 250 AND id <= 300";
Add " ORDER BY id" to order them on id or leave this way to get them in
the order they are stored in the database.
[Back to original message]
|