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.

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;


---------------------------------------------------------------------
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

Reply via email to