For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > November 2004 > Change all except the last X









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Change all except the last X
René

2004-11-17, 3:58 pm

Hello there,

With the SQL Update statement, I try to remove all articles from the
front page of Drupal, except for the last X.

What I did:

UPDATE node SET promote=0 WHERE promote=1 ORDER BY created ASC LIMIT 10
, 1000

Which should remove all from the frontpage except the youngest ten.

But I don't know what I am doing wrong. It returns:

#1064 - You have an error in your SQL syntax near 'ORDER BY created ASC
LIMIT 10, 1000' at line 1

Could somebody help me?

René



Steve

2004-11-17, 3:58 pm


No ORDER BY clause in an UPDATE statement unless you are using MySQL
4.*

---
Steve

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com