* Martijn Haak > >Description: > Using delete with no where statement results in a faulty message about > updated lines > >How-To-Repeat: > SQL-statements follow: > > mysql> select * from asses_cats; > +-------+-------+ > | ac_id | label | > +-------+-------+ > | 1 | test1 | > | 2 | test2 | > +-------+-------+ > 2 rows in set (0.00 sec) > > mysql> ## THIS IS THE STATEMENT CAUSING THE FAULTY REPORT > mysql> delete from asses_cats; > Query OK, 0 rows affected (0.00 sec)
This is as expected. A DELETE without a WHERE _deletes_ the table files, without even checking how many rows was in the table. > mysql> ## THIS IS THE CORRECTED STATEMENT > mysql> delete from asses_cats where 1=1; > Query OK, 2 rows affected (0.00 sec) This is the recommended workaround to get the actual number of deleted rows. <URL: http://www.mysql.com/doc/D/E/DELETE.html > -- Roger --------------------------------------------------------------------- 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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php