Я хочу удалить идентификаторы из types
, которых нет в types_photos
, но я не знаю, как это сделать. id_type
в types_photos
такие же, как id
в types
. Вот как выглядит структура таблицы:
CREATE TABLE IF NOT EXISTS `types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_user_added` int(11) DEFAULT '0',
`id_user_edited` int(11) DEFAULT '0',
`data_name` text NOT NULL,
`data_name_seo` text NOT NULL,
`data_type` enum('tag','equipment','search') NOT NULL,
`datetime_added` datetime NOT NULL,
`datetime_edited` datetime NOT NULL,
`ipaddress_added` text NOT NULL,
`ipaddress_edited` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
)
CREATE TABLE IF NOT EXISTS `types_photos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_user_added` int(11) DEFAULT '0',
`id_user_edited` int(11) DEFAULT '0',
`id_type` int(11) DEFAULT '0',
`id_photo` int(11) DEFAULT '0',
`datetime_added` datetime NOT NULL,
`datetime_edited` datetime NOT NULL,
`ipaddress_added` text NOT NULL,
`ipaddress_edited` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
)
Итак, мой вопрос; как я могу удалить все идентификаторы из types
, которых нет в types_photos
?