In an Access Query, I have two tables; Dimension and Transaction.
Dimension Table has columns DimLabel, DimCode and DimDescription. Transaction Table has columns TransactionNumber, Amount, DimCode1 and DimCode2. Below are example values to explain the query: (Values are separated by commas just for illustration)
Dimension Table:
(B,101,Funding Source 1)
(B,102,Funding Source 2)
(B,103,Funding Source 3)
(C,102,Program 2)
(C,103,Program 3)
(C,104,Program 4)
Transaction Table:
(1,1000,101,102)
(2,2000,102,103)
(3,3000,103,104)
I have to build a query, which can produce the following output:
(1,1000,101,Funding Source 1,102,Program 2)
(2,2000,102,Funding Source 2,103,Program 3)
(3,3000,103,Funding Source 3,104,Program 4)
With the following query, I am getting the first 5 columns:
But I am stuck as how to show the sixth column; i.e. Description of DimCode2 (I have to look for only those descriptions where Dimension.DimLabel=”C”)
Dimension Table has columns DimLabel, DimCode and DimDescription. Transaction Table has columns TransactionNumber, Amount, DimCode1 and DimCode2. Below are example values to explain the query: (Values are separated by commas just for illustration)
Dimension Table:
(B,101,Funding Source 1)
(B,102,Funding Source 2)
(B,103,Funding Source 3)
(C,102,Program 2)
(C,103,Program 3)
(C,104,Program 4)
Transaction Table:
(1,1000,101,102)
(2,2000,102,103)
(3,3000,103,104)
I have to build a query, which can produce the following output:
(1,1000,101,Funding Source 1,102,Program 2)
(2,2000,102,Funding Source 2,103,Program 3)
(3,3000,103,Funding Source 3,104,Program 4)
With the following query, I am getting the first 5 columns:
Code:
SELECT Transaction.TransactionNumber, Transaction.Amount, Transaction.DimCode1, Dimension.DimDescription, Transaction.DimCode2
FROM [Transaction], Dimension
WHERE (((Transaction.DimCode1)=[Dimension].[Dimcode]) AND ((Dimension.DimLabel)="B"));
But I am stuck as how to show the sixth column; i.e. Description of DimCode2 (I have to look for only those descriptions where Dimension.DimLabel=”C”)