Re: SQL WHERE datetime > NOW

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

 



"John Dillon" <ioannes@xxxxxxxxxxxxxx> wrote in message
news:004701c3d25e$d8b0f3a0$4aaf8051@xxxxxxxxxxxxxxxxx

> ...WHERE TO_DAYS(NOW())+1>TO_DAYS(MyTable.MyField) ORDER BY
MyTable.MyField DESC LIMIT 30";
>
> however, the LIMIT seems to apply before the ORDER BY clause.  How can I
get the LIMIT to apply after
> the ORDER BY?



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

Is there a function to get the top x number of results, as there is in MS
Access? Eg search on an auto-increment and get the last 10 records added?
(They don't always appear at the end of the table, I think if I am editing
the table they can appear after the currently active record.)

Regards,

John

-- 
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