View Single Post
  #3 (permalink)  
Old 08-06-2007, 06:09 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: why limit wont work for updats statement

Hi,

mysql> CREATE TABLE mytable
-> ( id INTEGER AUTO_INCREMENT PRIMARY KEY,
-> name VARCHAR(100) NOT NULL
-> )type=InnoDB;
Query OK, 0 rows affected, 1 warning (0.21 sec)

mysql> INSERT INTO mytable VALUES (1,'Test');
Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO mytable VALUES (2,'CanTest');
Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO mytable VALUES (3,'WillbeTested');
Query OK, 1 row affected (0.02 sec)

mysql> UPDATE mytable SET name = 'Completed' LIMIT 2;
Query OK, 2 rows affected (0.02 sec)
Rows matched: 2 Changed: 2 Warnings: 0

LIMIT works fine with update statement.

Hope this helps..
__________________
-Murali..
Reply With Quote