Hi,
I have three tables. One of the tables has a column that
is a foreign key that references columns from the other
two tables. This table is shown below.
CREATE TABLE `pheno` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`relevant` enum('y','n') default NULL,
`phenotype` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`,`phenotype`),
KEY `id` (`id`),
CONSTRAINT `0_125` FOREIGN KEY (`id`) REFERENCES
`monogenic` (`phenotype_ID`) ON DELETE CASCADE,
CONSTRAINT `0_127` FOREIGN KEY (`id`) REFERENCES
`knockout` (`phenotype_ID`) ON DELETE CASCADE
) TYPE=InnoDB
The problem is that I can't insert a record into this
table unless the value of 'id' is present in both the
mongenic and knockout tables. I receive the following error:
Cannot add or update a child row: a foreign key
constraint fails
It doesn't make sense for entries in the pheno table to
be duplicated in the monogenic and knockoout tables.
I can only assume that a foreign key can only reference
one table, although it allows me to create the key, just
not to insert data. Is this correct?
tia
Rich
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]