2011-03-24 71 views
3

外键我得到这个错误不能创建MySQL表

#1005 - Can't create table 'chris_db.#sql-1464b_66' (errno: 150) (<a href="server_engines.php?engine=InnoDB&amp;page=Status&amp;token=7a7f690fbd1413e74979d79fa9044fb0">Details...</a>) 

Comp_Competition表有CompetitionID集作为主键。有人熟悉这个问题吗?

回答

0

您的Comp_Entry表需要一个竞争ID的现有索引。另外,你的命令在表Comp__Competition的名称中有两个__个字符,但在你的解释中只有一个。哪一个是对的?

0

因为在你的表格数据不脚的约束(例如不存在的键)

尽量使

 select * from Comp_Entry where CompetitionID not in 
     (select distinct CompetitionID from Comp__Competition)