Re: Re: SQL WHERE datetime > NOW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello John,

Tuesday, January 6, 2004, 5:20:22 PM, you wrote:

J> On further reading, it appears LIMIT stops the query running once x number
J> of records are retrieved without sorting the whole table first.

Where did you read this?

If you profile your query you'll notice that in say a 10,000 record
table, if you LIMIT 0,50 but order by something generic (say an ID or
date stamp) it'll still order all 10,000 records before returning the
50 you asked for.

(One of the main reasons I rarely use LIMIT)

J> Is there a function to get the top x number of results, as there is in MS
J> Access? Eg search on an auto-increment and get the last 10 records added?

LIMIT 50,-1

Retrieve from row 50 to last.

-- 
Best regards,
 Richard                            mailto:rich@xxxxxxxxxxxxxxxx

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux