我有两张桌子TABLE_ACCOUNT
和TABLE_ACTYPE
.
有TABLE_ACCOUNT
列
(CODE, NAME, TRADE, CATGORY, ACTYPE)
并且TABLE_ACTYPE
有列
(CODE, NAME, ITYPE)
中的数据TABLE_ACTYPE
是:
CODE NAME ITYPE
-----------------------
1 TRADE1 1
1 CAT1 2
1 ACT1 3
此表的主键是CODE, TYPE
中的数据TABLE_ACCOUNT
是:
CODE, NAME, TRADE, CATEGORY, ACTYPE
-----------------------------------
1 Name1 1 1 1
我想为 to 创建 3 个外键table_account
ALTER TABLE TABLE_ACCOUNT WITH CHECK
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_TRADE
FOREIGN KEY ([TRADE,1]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)
ALTER TABLE TABLE_ACCOUNT WITH CHECK
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_CAT
FOREIGN KEY ([TRADE,2]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)
ALTER TABLE TABLE_ACCOUNT WITH CHECK
ADD CONSTRAINT FK_TABLE_ACCOUNT_TABLE_ACTYPE_ACTYPE
FOREIGN KEY ([TRADE,3]) REFERENCES [TABLE_ACTYPE] (CODE, ITYPE)
这可能吗??