title: Multiple columns of a table refer to same foreign key column
body: <p>I am having a table named subcategories whose records could further be linked to other records in the table. So I have created a <code>subcategorylinker</code> table which defines these links. In this table I have 2 columns subcategory and <code>nextsubcategory</code> both of which refer to id field of subcategories table. But I am getting an error during table creation. The error is as given below:</p>
  
  <pre><code>ERROR 1005: Can't create table 'test01.subcategorylinker' (errno: 150)
  </code></pre>
  
  <p>Table definition is as follows:</p>
  
  <pre><code>CREATE  TABLE `test01`.`subcategorylinker` (    
    `id` INT NOT NULL ,            
    `subcategory` INT NOT NULL ,    
    `nextsubcategory` INT NOT NULL ,    
    PRIMARY KEY (`id`) ,    
    INDEX `fk_subcategorylinker_sub` (`subcategory` ASC, `nextsubcategory` ASC) ,    
    CONSTRAINT `fk_subcategorylinker_sub`    
      FOREIGN KEY (`subcategory` , `nextsubcategory` )    
      REFERENCES `test01`.`subcategories` (`id` , `id` )    
      ON DELETE NO ACTION    
      ON UPDATE NO ACTION);
  </code></pre>