Hi! The MySQL manual states that you can use ORDER BY in combination with the UPDATE statement. So I tried to use it, but it didn't work. Here is the sql query that's causing the trouble: mysql> UPDATE alarms SET is_parsed=1 WHERE is_parsed=0 ORDER BY is_parsed LIMIT 1; ERROR 1064: You have an error in your SQL syntax near 'order by is_parsed limit 1' at line 1 The same error happens when I don't use LIMIT: mysql> UPDATE alarms SET is_parsed=1 WHERE is_parsed=0 ORDER BY is_parsed; ERROR 1064: You have an error in your SQL syntax near 'order by is_parsed' at line 1 Here is the table's structure: CREATE TABLE alarms ( serial int(10) unsigned NOT NULL auto_increment, sys_num tinyint(2) unsigned NOT NULL default '1', rtu_num smallint(4) unsigned NOT NULL default '0', status char(2) NOT NULL default 'XX', received datetime default NULL, device tinyint(2) unsigned NOT NULL default '0', is_parsed tinyint(1) unsigned NOT NULL default '0', PRIMARY KEY (serial), KEY is_parsed (is_parsed), KEY rtu_num (rtu_num) ) TYPE=MyISAM; When I first noticed the problem, I was running mysql 3.23.34a source distribution on a Slackware Linux 7.1. Then I upgraded to 3.23.37 but the problem remains. Could you plese help me! What am I doing wrong here? Thank you in advance! George ---- Безплатна пощенска служба http://mail.Rambler.bg/ --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php