Error: No unique index found for the referenced field of the primary table
<p>I'm trying to create a database with a AnySQL Maestro script. I have the following code:</p>

<pre><code>create table KLANT
(
   Klantnr integer,
   Naam varchar(255),
   Adres varchar(255),
   Plaats varchar(255),

   constraint pk_klant
   primary key (Klantnr)
); -- go


create table MEDEWERKER
(
   Mdwnr integer,
   Naam varchar(255),
   Telnr integer,
   Afdnr integer,

   constraint pk_medewerker
   primary key (Mdwnr)       
); -- go

create table AFDELING
(
   Afdnr integer,
   Afdnaam varchar(255),
   Mdwnr integer,

   constraint pk_afdeling
   primary key (Afdnr)
); -- go

alter table MEDEWERKER
add constraint fk_medewerker_afdeling foreign key(Afdnr) references Afdeling(Afdnr);

alter table AFDELING
add constraint fk_afdeling_medewerker foreign key(Mdwnr) references Medewerker(Mdwnr);


create table TAAK
(
   Taaknr integer,
   ProjID integer,
   Urenomvang integer,

   constraint pk_taak
   primary key (Taaknr, ProjID)
); -- go

create table Project
(
   ProjID integer,
   ProjNaam varchar(255),
   Startdatum varchar(255),
   Sluitdatum varchar(255),
   Klantnr integer,
   Mdwnr integer,
   ParentProjid integer,

   constraint pk_project
   primary key (ProjID),

   constraint fk_project_klantnr
   foreign key(Klantnr) references klant(Klantnr),

   constraint fk_project_medewerker
   foreign key(Mdwnr) references medewerker(Mdwnr)
); -- go

alter table TAAK
    add constraint fk_taak_project foreign key(ProjID) references    Project(ProjID);

create table Assignment
(
   Mdwnr integer,
   ProjID integer,
   Taaknr integer,
   Weeknr integer,
   AantalUren integer,

   constraint pk_assignment
   primary key (Mdwnr, ProjID, Taaknr, Weeknr),

   constraint fk_assignment_medewerker
   foreign key(Mdwnr) references medewerker(Mdwnr),

   constraint fk_assignment_project
   foreign key(ProjID) references Project(ProjID),

   constraint fk_assignment_taak
   foreign key(Taaknr) references Taak(Taaknr)       
); -- go
</code></pre>

<p>Unfortunately, the last table Assignment gives the following error message:</p>

<p>No unique index found for the referenced field of the primary table</p>

<p>Can someone help me? I'm stuck</p>