I keep getting the following error when trying to make one column in a table refference another column in another table.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY (campaignid) REFERENCES campaigns(id)' at line 1
In this case I want to have the column “campaignid” in table “pages” refference (= to) column “id” in the table “campaigns.
ALTER TABLE pages FOREIGN KEY (campaignid) REFERENCES campaigns(id)
Can anyone see where I am going wrong?
Thanks in advance!
Your missing the
ADDkeyword i suppose (MySQL docu):