$result = mysql_query("SELECT id FROM table WHERE foo = '$bar' ORDER BY id DESC LIMIT 25");
That will return the latest 25 records, which I want to keep. However if this query returned 100 records, how could I delete records 26-100?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
DELETE FROM table WHERE foo = '$bar' LIMIT 25,999999
I've never tried something like that with a delete.. does delete have a limit clause
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Everah wrote:DELETE and UPDATE both support limits. And when it comes to subqueries check your MySQL version. I think only MySQL 4.3+ support subqueries.