Inaccurate return value from DELETE query

2012-02-11 Thread Fayaz Yusuf Khan
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


signature.asc
Description: This is a digitally signed message part.


Re: How to find values which do not return any tuple in IN clause

2011-06-10 Thread Fayaz Yusuf Khan
On Saturday 11 Jun 2011 4:06:27 AM Fahim Mohammad wrote:
 select * from  tablename where fieldname in ('aaa','bbb','ccc','ddd');
 How can I know how many out of four ('aaa','bbb','ccc','ddd') resulted in a
 miss OR which values do not return any tuple.
Perhaps this  would be what you're looking for?
SELECT fieldname,COUNT(*) FROM tablename WHERE fieldname IN 
('aaa','bbb','ccc','ddd') GROUP BY fieldname;

-- 
Fayaz Yusuf Khan
Cloud developer and designer in Python/AppEngine platform
Dexetra Software Solutions Pvt. Ltd., Kochi, Kerala, India
B.Tech. Computer Science  Engineering (2007-2011)
Model Engineering College, Kochi, Kerala, India
Registered Linux user #484201
fayaz.yusuf.k...@gmail.com
fa...@dexetra.com
+91-9746-830-823


signature.asc
Description: This is a digitally signed message part.