I solved it myself :) You need to keep the primary keys in the same order as the index, DOH! ofcourse :)
In parant table PRIMARY KEY(key1,key2) In child table INDEX(key_fk1, key_fk2) Regards /Jonas ----- Original Message ----- From: "Jonas Lndén" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 11, 2004 2:49 PM Subject: Referencing multiple primary keys Hello, I am banging my head against the wall trying to figure out how to construct a foreign key towards a table with a primary key consisting of two columns. I have been googling around and thought this would work, but it just gives me an ERROR 1005. ALTER TABLE testDB ADD FOREIGN KEY (fkey1, fkey2) REFERENCES secondDB(col1, col2) ON DELETE SET NULL; Is there someone who could point me in the right direction? I have indexed the foreign keys in testDB. Regards /Jonas Lindén -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]