Sql 访问已存在关系的Dlookup
我有一个事实表,它有一个主键Sql 访问已存在关系的Dlookup,sql,ms-access-2010,Sql,Ms Access 2010,我有一个事实表,它有一个主键结束项代码和一个外键开始项代码。主键与dim表项信息表保持连接,外键也可以在该表中。我想得到一个列Dlookup'd,而不是创建另一个查询来连接到我的事实表,但我认为我的语法不正确,而且我找不到任何关于像这样使用Dlookup的人的信息。我做错了什么 特定DLOOKUP代码: DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Sta
结束项代码
和一个外键开始项代码
。主键与dim表项信息表保持连接,外键也可以在该表中。我想得到一个列Dlookup'd,而不是创建另一个查询来连接到我的事实表,但我认为我的语法不正确,而且我找不到任何关于像这样使用Dlookup的人的信息。我做错了什么
特定DLOOKUP代码:
DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Start Item Description]
事实表:
Starting Item Code | Ending Item Code
_____________________________________
1050 1051
Item Code | Description
_______________________
1050 Chum
1051 Krabby Paddies
SELECT
FT.Starting Item Code,
FT.Ending Item Code,
DT.Description AS [Ending Item Description],
DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Start Item Description]
FROM [Fact Table] AS FT
LEFT JOIN [Dim Table] AS DT
ON FT.[Ending Item Code] = DT.[Item Code]
Starting Item Code | Starting Item Description | Ending Item Code | Ending Item Description
____________________________________________________________________________________________
1050 Chum 1051 Krabby Paddies
暗表:
Starting Item Code | Ending Item Code
_____________________________________
1050 1051
Item Code | Description
_______________________
1050 Chum
1051 Krabby Paddies
SELECT
FT.Starting Item Code,
FT.Ending Item Code,
DT.Description AS [Ending Item Description],
DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Start Item Description]
FROM [Fact Table] AS FT
LEFT JOIN [Dim Table] AS DT
ON FT.[Ending Item Code] = DT.[Item Code]
Starting Item Code | Starting Item Description | Ending Item Code | Ending Item Description
____________________________________________________________________________________________
1050 Chum 1051 Krabby Paddies
SQL代码:
Starting Item Code | Ending Item Code
_____________________________________
1050 1051
Item Code | Description
_______________________
1050 Chum
1051 Krabby Paddies
SELECT
FT.Starting Item Code,
FT.Ending Item Code,
DT.Description AS [Ending Item Description],
DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Start Item Description]
FROM [Fact Table] AS FT
LEFT JOIN [Dim Table] AS DT
ON FT.[Ending Item Code] = DT.[Item Code]
Starting Item Code | Starting Item Description | Ending Item Code | Ending Item Description
____________________________________________________________________________________________
1050 Chum 1051 Krabby Paddies
我想要的查询结果:
Starting Item Code | Ending Item Code
_____________________________________
1050 1051
Item Code | Description
_______________________
1050 Chum
1051 Krabby Paddies
SELECT
FT.Starting Item Code,
FT.Ending Item Code,
DT.Description AS [Ending Item Description],
DLOOKUP(" [Descripition] "," [DIM TABLE] ", " FT.[Starting Item Code] = DT.[Item Code] ") AS [Start Item Description]
FROM [Fact Table] AS FT
LEFT JOIN [Dim Table] AS DT
ON FT.[Ending Item Code] = DT.[Item Code]
Starting Item Code | Starting Item Description | Ending Item Code | Ending Item Description
____________________________________________________________________________________________
1050 Chum 1051 Krabby Paddies