...

View Full Version : why doesnt limit work fully



jeromepelletier
09-17-2006, 02:57 AM
Why is it, when you have a query, and you limit something, it doesntlimit the records searched? such as, i have a query that searches for "joe" and puts it in ASC order and limit 5, itll go through all joe's, is limit only good for displaying records, such as only 5 records show, ? if that made any sense :)

guelphdad
09-17-2006, 03:03 AM
in a select yes the limit is only telling how many records to display and which ones dependent on an order by clause.

if you use



select
foo,
bar,
qux
from yourtable
order by foo
limit 5


it would show the first five records according to foo ascending.

limit 5 can be rewritten as 0,5 which says start at row 0 and show 5 records.

if you used limit 5,5 it says to start at record after 5 and show the next five records.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum