Hi!

>CREATE TABLE IF NOT EXISTS GROUP_CONCLUSION_GROUPING(
>ANALYSIS_RESULT_ID     MEDIUMINT(20)  PRIMARY KEY REFERENCES
PAD_ANALYSIS_RESULT(ANALYSIS_RESULT_ID),
>GROUP_CONCLUSION_ID    MEDIUMINT(20)  PRIMARY KEY REFERENCES
GROUP_CONCLUSION(GROUP_CONCLUSION_ID)
>) Type=InnoDB;

I guess the following is what you want. It also conforms to the FOREIGN KEY
syntax of InnoDB.

CREATE TABLE GROUP_CONCLUSION_GROUPINGS(

  ANALYSIS_RESULT_ID MEDIUMINT(20) NOT NULL,
  GROUP_CONCLUSION_ID MEDIUMINT(20) NOT NULL,

  PRIMARY KEY (ANALYSIS_RESULT_ID, GROUP_CONCLUSION_ID),
  INDEX (GROUP_CONCLUSION_ID),

  FOREIGN KEY (ANALYSIS_RESULT_ID) REFERENCES
                      PAD_ANALYSIS_RESULT(ANALYSIS_RESULT_ID),
  FOREIGN KEY (GROUP_CONCLUSION_ID) REFERENCES
                      GROUP_CONCLUSION(GROUP_CONCLYSION_ID)
) TYPE = INNODB;

This assumes the two ..._ID columns determine the row uniquely in
GROUP_CONCLUSION_GROUPINGS. That is, we can make them the primary key. A
table cannot have two primary keys. Also, InnoDB requires foreign keys to be
declared separately in the CREATE TABLE statement: you cannot declare them
in the column definition.

See the manual at http://www.innodb.com/ibman.html

Regards,

Heikki
http://www.innodb.com
--
Order commercial MySQL/InnoDB support at https://order.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

Reply via email to