On Mon, Jan 28, 2002 at 06:48:30PM +0200, Heikki Tuuri wrote: : Philip. : : you must have an index on the referenced key in the parent table. Now : test_base has no indexes at all.
Apparently, you also need indexes on the child table: mysql> create table test_bk ( fld int not null, primary key (fld) ); Query OK, 0 rows affected (0.00 sec) mysql> create table test_fkey ( fld1 int not null, fld2 int not null, foreign key (fld1) references test_bk(fld), foreign key (fld2) references test_bk(fld)); ERROR 1005: Can't create table './test/test_fkey.frm' (errno: 150) mysql> create table test_fkey ( fld1 int not null, fld2 int not null, foreign key (fld1) references test_bk(fld)); ERROR 1005: Can't create table './test/test_fkey.frm' (errno: 150) mysql> create table test_fkey ( fld1 int not null, fld2 int not null, index (fld1), foreign key (fld1) references test_bk(fld)); Query OK, 0 rows affected (0.00 sec) mysql> drop table test_fkey; Query OK, 0 rows affected (0.00 sec) mysql> create table test_fkey ( fld1 int not null, fld2 int not null, index (fld1), index (fld2), foreign key (fld1) references test_bk(fld), foreign key (fld2) references test_bk(fld)); Query OK, 0 rows affected (0.01 sec) * Philip Molter * Texas.net Internet * http://www.texas.net/ * [EMAIL PROTECTED] --------------------------------------------------------------------- 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