Well, i have two tables
publica_evento_grupo
Field | Type | Null | Key | Default | Extra
id_evento_grupo int(10) unsigned NO PRI auto_increment
id_evento int(8) unsigned NO MUL
id_grupo int(8) unsigned NO MUL
identificacao varchar(55) NO
publica_identificacao_publicacao
Field | Type | Null | Key | Default | Extra
id_evento int(8) unsigned NO PRI
identificacao varchar(55) NO PRI
publica_evento_grupo
.id_evento
in is a foreign key to a third table called publica_evento but is also a foreign key together with the column to the table publica_identificacao_publicacao
.identificacao
. The problem is, I got to create the foreign key that relates publica_evento_grupo to publica_identificacao_publicacao by the key id_evento
, but when I try to create the another FK with the column identificacao
, it gives the errno below
[Err] 1005 - Can't create table '#sql-1049_1980992' (errno: 150).
As you can see the table publica_identificacao_publicacao has two PK and that iss the reason that it has to be 2 FK to relate them, i didn't create the indexes yet, because as far as i know, i just have to create the indexes after adding the FK contraints, and I was able to create the FK contraint to the column id_evento
between evento_grupo and identificacao_publicacao, i don't know why just the column identificacao
is giving this error
EDIT 1: @RolandBouman i don't have the permission to use that command SHOW ENGINE INNODB STATUS
EDIT 2: @Geoff_Montee acctually the command you passed worked, to undestand why i use that structure take a look at this question MySQL UNIQUE Constraint multiple columns condition