I think it's because of the constraint that you've defined on the table. So 
that the record with friday_id=1 won't be deleted because of the constraint.

Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-----Original Message-----
From: Fayaz Yusuf Khan <fa...@dexetra.com>
Date: Sat, 11 Feb 2012 22:03:45 
To: <mysql@lists.mysql.com>
Subject: Inaccurate return value from DELETE query

CREATE TABLE `People` (
  `friday_id` bigint(20) NOT NULL,
  `parent_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`friday_id`),
  KEY `parent_id` (`parent_id`),
  CONSTRAINT `People_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `People` 
(`friday_id`) ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO People (friday_id, parent_id) values (1,1), (2,1);


DELETE FROM People;
Output: Query OK, 1 row affected

Shouldn't this be 2 rows affected?

MySQL version 5.1
-- 
Fayaz Yusuf Khan
Cloud developer and architect
Dexetra SS, Bangalore, India
fayaz.yusuf.khan_AT_gmail_DOT_com
fayaz_AT_dexetra_DOT_com
+91-9746-830-823

Reply via email to