BKR, you can have any number of foreign keys in a single table.
But you have not created the necessary indexes on foreign keys: ... Both tables have to be InnoDB type and there must be an index where the foreign key and the referenced key are listed as the first columns. InnoDB does not auto-create indexes on foreign keys or referenced keys: you have to create them explicitly. Corresponding columns in the foreign key and the referenced key must have similar internal data types inside InnoDB so that they can be compared without a type conversion. The size and the signedness of integer types has to be the same. The length of string types need not be the same. ... Best regards, Heikki Tuuri Innobase Oy --- Order technical MySQL/InnoDB support at https://order.mysql.com/ See http://www.innodb.com for the online manual and latest news on InnoDB ----- Original Message ----- From: ""B.K.R. Shivaprakkash"" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Saturday, July 13, 2002 7:13 AM Subject: Re: More than one foreign key in a table > Hi, > > The below mentioned sql makes an error when created > with two foreign key constraints under MySQL/Innodb > table type. Any help to solve this problem? > > create table UserMenuRestrictions > ( > CompanyCode char(10) not null, > UserId char(10) not null, > MenuName char(40) not null, > MenuParentName char(40) not null, > AddRight char(1) , > EditRight char(1) , > DeleteRight char(1) , > ViewRight char(1) , > Visible char(1) , > Enabled char(1) , > primary key (CompanyCode, UserId, MenuName, > MenuParentName), > foreign key (CompanyCode, UserId) > references UserDetails (CompanyCode, UserId) > on update restrict on delete restrict , > foreign key (MenuName, MenuParentName) > references MenuDetails (MenuName, MenuParentName) > on update restrict on delete restrict > ) type = innodb; > > Thankyou in advance. > > Happiness Always > BKR Shivaprakkash > > > __________________________________________________ > Do You Yahoo!? > Everything you'll ever need on one web page > from News and Sport to Email and Music Charts > http://uk.my.yahoo.com > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php