我有一个数据库和两个表,Male
两个Female
表int primary key with the name ID
都有一个外键,两个表的外键都在一个单独的名为RecommendFemale
.
男表:
男性 :
[dbo].[Male] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[Image] VARCHAR (MAX) NULL,
[Name] VARCHAR (50) NULL,
[Age] INT NULL,
CONSTRAINT [PK_Female] PRIMARY KEY CLUSTERED ([ID] ASC)
);
女性 :
[dbo].[Female] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[Image] VARCHAR (MAX) NULL,
[Name] VARCHAR (50) NULL,
[Age] INT NULL,
CONSTRAINT [PK_Female] PRIMARY KEY CLUSTERED ([ID] ASC)
);
推荐 :
[dbo].[RecommendFemale] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[RecommendTo] INT NOT NULL,
[Recommend] INT NOT NULL,
CONSTRAINT [PK_RecommendFemale] PRIMARY KEY CLUSTERED ([ID] ASC),
CONSTRAINT [FK_Table_1_Female] FOREIGN KEY ([RecommendTo]) REFERENCES [dbo].[Female] ([ID]),
CONSTRAINT [FK_Table_1_Male] FOREIGN KEY ([Recommend]) REFERENCES [dbo].[Male] ([ID])
);
RecommendTo 是表 ID 的外键Female
,Recommend 是表 ID 的外键值Male
。
我的问题是我想value
在列表视图中显示与外键关联的
示例:表在列Recommend
中有多个外键值女性,列列表具有男性表的值。RecommendTo
recommend
我想将与 关联的值显示RecommendTo
到列表视图中,即 ID 4 在外键表中有多个值,我想将与该单个数字关联的值显示到列表视图中,该怎么做?