У меня есть 3 таблицы, и мне нужно выбрать несколько записей,
В двух таблицах из них у меня есть поля с одинаковыми именами, и когда я пытаюсь использовать Where Expression для этих полей, я получаю сообщение об ошибке:
Если я использую TABLENAMe.Columns.COLNAME, это сообщение об ошибке показывает: Неоднозначное имя столбца 'FKLoginID'.
и если я использую TableNAme.COLColumn.QualifiedName, он имеет ошибку рядом с созданным параметром "@ [dbo]. [Tbl_PersonalInformation]. [FKLoginID] 0"
Как я могу запросить эти таблицы?
Спасибо
SqlQuery q = new Select().From(Tables.TblStockbrokerBroadDirector)
.InnerJoin(TblPersonalInformation.PersonalInfoIDColumn, TblStockbrokerBroadDirector.FKPersonalInfoIDColumn)
.InnerJoin(TblCompanyInformation.BizInfoIDColumn, TblStockbrokerBroadDirector.FKBizInfoIDColumn)
.Where(TblPersonalInformation.FKLoginIDColumn.QualifiedName).IsEqualTo(User.Identity.Name);
CREATE TABLE [dbo].[Tbl_CompanyInformation](
[Code] [bigint] IDENTITY(111111111,1) NOT NULL,
[BizInfoID] [nvarchar](20) NOT NULL,
[BizName] [nvarchar](50) NOT NULL,
[RegisterationNO] [nvarchar](50) NOT NULL,
[RegisterationPlace] [bigint] NOT NULL,
[TypeBiz] [nvarchar](50) NOT NULL,
[DirectManagerCode] [nvarchar](20) NOT NULL,
[FKAddressID] [nvarchar](20) NOT NULL,
[FKLoginID] [nvarchar](20) NOT NULL,
[SabtDate] [nvarchar](50) NOT NULL,
[NewName] [nvarchar](50) NULL,
[OldName] [nvarchar](50) NULL,
[DateTasisAgahi] [nvarchar](50) NOT NULL,
[NOTasisAgahi] [nvarchar](20) NOT NULL,
[NOAsasname] [nvarchar](20) NOT NULL,
[FKStatus] [smallint] NOT NULL CONSTRAINT [DF_Tbl_CompanyInformation_FKStatus] DEFAULT ((0)),
CONSTRAINT [PK_Tbl_CompanyInformation_1] PRIMARY KEY CLUSTERED
(
[Code] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_Tbl_Biz] UNIQUE NONCLUSTERED
(
[BizInfoID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_Tbl_CompanyRegNoP] UNIQUE NONCLUSTERED
(
[RegisterationNO] ASC,
[RegisterationPlace] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Tbl_PersonalInformation](
[Code] [bigint] IDENTITY(111111111,1) NOT NULL,
[PersonalInfoID] [nvarchar](20) NOT NULL,
[FKLoginID] [nvarchar](20) NULL,
[FirstName] [nvarchar](50) NOT NULL,
[LastName] [nvarchar](150) NOT NULL,
[SSN] [nvarchar](10) NOT NULL,
[NationalCode] [nvarchar](10) NOT NULL,
[CopyNCard] [image] NULL,
[Birthyear] [nvarchar](50) NOT NULL,
[Birthplace] [bigint] NOT NULL,
[FKProvince] [smallint] NOT NULL,
[FKAddressID] [nvarchar](20) NOT NULL,
[Phone] [nvarchar](50) NULL,
[Sex] [bit] NOT NULL CONSTRAINT [DF_Tbl_PersonalInformation_Sex] DEFAULT ((0)),
[FKStatus] [smallint] NULL CONSTRAINT [DF_Tbl_PersonalInformation_FKStatus] DEFAULT ((0)),
CONSTRAINT [PK_Tbl_PersonalInformation_1] PRIMARY KEY CLUSTERED
(
[Code] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_Tbl_PersonalInformation] UNIQUE NONCLUSTERED
(
[PersonalInfoID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
CREATE TABLE [dbo].[Tbl_Stockbroker_BroadDirector](
[Code] [bigint] IDENTITY(111111111,1) NOT NULL,
[StockbrokerCode] [nvarchar](20) NOT NULL,
[FKBizInfoID] [nvarchar](20) NOT NULL,
[FKPersonalInfoID] [nvarchar](20) NULL,
[IsStockbroker] [bit] NOT NULL CONSTRAINT [DF_Tbl_Stockbroker_BroadDirector_IsStockbroker] DEFAULT ((0)),
[IsBoardDirector] [bit] NOT NULL CONSTRAINT [DF_Tbl_Stockbroker_BroadDirector_IsBoardDirector] DEFAULT ((0)),
[FKStatus] [smallint] NULL CONSTRAINT [DF_Tbl_Stockbroker_BroadDirector_status] DEFAULT ((0)),
[StockPercent] [float] NULL CONSTRAINT [DF_Tbl_Stockbroker_BroadDirector_StockPercent] DEFAULT ((0)),
[SahamdarHoghoghi] [bit] NULL,
[FkBizinfoIDSahamdar] [nvarchar](20) NULL,
CONSTRAINT [PK_Tbl_Stockbroker_BroadDirector] PRIMARY KEY CLUSTERED
(
[Code] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_Tbl_Stockbroker_Code] UNIQUE NONCLUSTERED
(
[StockbrokerCode] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]