On Saturday 08 March 2003 02:27, Daevid Vincent wrote: > Can I have multiple foreign keys in a table? Like this... I ask because I > can't seem to get it to work. Errno: 150.
Yes, you can. Check that all tables are InnoDB, that columns have the same type and so on .. > > CREATE TABLE `dept_table` ( > `dept_id` mediumint(8) unsigned NOT NULL auto_increment, > `dept_timestamp` timestamp(14) NOT NULL, > `dept_company_table_id` mediumint(8) unsigned NOT NULL default '0' > REFERENCES company_table(company_id), > `dept_rep_table_id` smallint(8) unsigned default NULL REFERENCES > rep_table(rep_id), > `dept_name` varchar(255) NOT NULL default '', > `dept_SCM_10` date NOT NULL default '0000-00-00', > `dept_SCM_20` date NOT NULL default '0000-00-00', > `dept_SCM_40` date NOT NULL default '0000-00-00', > `dept_SCM_60` date NOT NULL default '0000-00-00', > `dept_SCM_80` date NOT NULL default '0000-00-00', > `dept_SCM_90` date NOT NULL default '0000-00-00', > `dept_SCM_100` date NOT NULL default '0000-00-00', > `dept_notes` text NOT NULL, > PRIMARY KEY (`dept_id`), > KEY `dept_company_table_id` (`dept_company_table_id`), > KEY `dept_rep_table_id` (`dept_rep_table_id`), > FOREIGN KEY (dept_company_table_id) REFERENCES company_table(company_id) > ON DELETE CASCADE, > FOREIGN KEY (dept_rep_table_id) REFERENCES rep_table(rep_id) ON DELETE > SET NULL > ) TYPE=InnoDB; -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.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