SachAccess
Active member
- Local time
- Tomorrow, 00:59
- Joined
- Nov 22, 2021
- Messages
- 408
Hi,
I am new to access. Kindly pardon me for such question.
Am trying to understand below query. I have multiple queries in my DB.
Your guidance will help me to understand rest of the queries more easily.
From below query, my understating is that a LEFT join is used to take result from My_Table_1 and My_Table_2.
Fields My_ID and Product_ID are present in the both the tables.
Quantity field is present only in one table.
I know there is a start date and end date taken as input but am not able to understand ‘[Test]’ this part of the query.
Actual query is as below
Details of the parameters used in the query.
Quantity = field name from table 'My_Table_2'
My_ID = field name from table 'My_Table_1'
My_ID = field name from table 'My_Table_2'
Product_ID = field name from table 'My_Table_1'
Product_ID = field name from table 'My_Table_2'
Result of the query.
When I click on this query, I get three fields, My_ID, Product_ID, Item_Name and few columns for dates.
My apologies if am asking for too much with very few / incomplete details.
Thanks.
PS - I have edited original query due to security reasons. Original query provides correct result.
I am new to access. Kindly pardon me for such question.
Am trying to understand below query. I have multiple queries in my DB.
Your guidance will help me to understand rest of the queries more easily.
From below query, my understating is that a LEFT join is used to take result from My_Table_1 and My_Table_2.
Fields My_ID and Product_ID are present in the both the tables.
Quantity field is present only in one table.
I know there is a start date and end date taken as input but am not able to understand ‘[Test]’ this part of the query.
Actual query is as below
Code:
PARAMETERS [Forms]![Test]![Start_Date] DateTime, [Forms]![Test]![End_Date] DateTime;
TRANSFORM Nz(Sum(My_Table_2.Quantity),0) AS SumOfQuantity
SELECT My_Table_1.My_ID, My_Table_1.Product_ID, My_Table_1.Item_Name
FROM My_Table_1 LEFT JOIN My_Table_2 ON (My_Table_1.My_ID = My_Table_2.My_ID) AND (My_Table_1.Product_ID = My_Table_2.Product_ID)
GROUP BY My_Table_1.My_ID, My_Table_1.Product_ID, My_Table_1.Item_Name
PIVOT My_Table_2.Record_Date;
Details of the parameters used in the query.
Quantity = field name from table 'My_Table_2'
My_ID = field name from table 'My_Table_1'
My_ID = field name from table 'My_Table_2'
Product_ID = field name from table 'My_Table_1'
Product_ID = field name from table 'My_Table_2'
Result of the query.
When I click on this query, I get three fields, My_ID, Product_ID, Item_Name and few columns for dates.
My apologies if am asking for too much with very few / incomplete details.
Thanks.
PS - I have edited original query due to security reasons. Original query provides correct result.
Last edited: