これらのテーブルを 1 つのテーブルにマージする必要がありますか? トリッキーな代替手段はありますか?
Table Unit for a Template table:
Id (PK)
ParentId
Name
TemplateId (FK)
Table Unit2 for a Testplan table:
Id (PK)
ParentId
Name
TestplanId (FK)
編集:
次のような表を作成してみませんか。
[UnitId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[TemplateId] [int] NULL,
[TestplanId] [int] NULL,
[ParentId] [int] NULL,
更新 2:
1 Template has N Unit
1 Template has N Testplan
1 Testplan has N Unit
これらは、1 つの Unit テーブルを使用した関係です。ただし、これは Unit テーブルの TemplateId AND TestplanId でのみ機能します。