|
ergot72
Starting Member
1 Posts |
Posted - 01/17/2013 : 05:41:49
|
I have a database set up sort of like this
Table1(id, ...) Table2(id, ...) Comment(id, typeId, str)
where typeId=1 means Table1 and typeId=2 means Table2
what I want to do is to create foreign keys to Table1 and Table2 from Comment sort of ALTER TABLE Comment ADD CONSTRAINT FK_Comment_Table1 FOREIGN KEY(id, typeId) REFERENCES Table1 (id, 1); ALTER TABLE Comment ADD CONSTRAINT FK_Comment_Table2 FOREIGN KEY(id, typeId) REFERENCES Table2 (id, 2);
Is it possible? If not, how should I set up the relations?
|
|