Results 1 to 6 of 6
Thread: Missing Records
Feb 15, 2010, 08:22 #1
I have two tables
CREATE TABLE IF NOT EXISTS `movies` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE IF NOT EXISTS `chapters` ( `mc_mov_id` int(10) unsigned NOT NULL DEFAULT '0', `mc_lang` char(2) CHARACTER SET latin1 NOT NULL, `mc_chapter_num` int(10) NOT NULL, PRIMARY KEY (`mc_mov_id`,`mc_chapter_num`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SELECT * FROM chapters WHERE mc_mov_id=698 - contains records.
SELECT * FROM movies WHERE id=698 - contains no records.
How do I delete the records from chapters that don't have a corresponding record in the movies table?