Bonjour,
Mon probleme est un problème de foreign key
mes tables :
t1 tlink t2
---- ---- -----
id t1_id id
info t2_d info
ma requete
DELETE tlink, t2
FROM tlink, t2
WHERE tlink.t1_id = 39 AND tlink.t2_id = 15 AND t2.id = 15
mais quand je l execute j ai une erreur de foreign key. Dans l aide de mysql ils donnent comme indication de donner un ordre dans la déclaration des foreign key mais rien de plus. Je ne vois pas trop.
voila le code des creation de table :
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL auto_increment,
`info` varchar(20) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t2` (
`id` int(10) unsigned NOT NULL auto_increment,
`info` varchar(20) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tlink` (
`t1_id` int(10) unsigned NOT NULL,
`t2_id` int(10) unsigned NOT NULL,
KEY `t1` (`t1_id`),
KEY `t2` (`t2_id`),
CONSTRAINT `tlink_FK_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`),
CONSTRAINT `tlink_FK_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
merci d avance pour les details du fonctionnement
Configuration: Windows XP
Internet Explorer 7.0