I have a query that I am having problems with, please help:
SELECT R_Project_AllTaskDates.Program_Yr, R_Project_AllTaskDates.[Project Id], W_Data_SA_Download.[Pack Item #], W_Data_SA_Download.PS, W_Data_SA_Download.SA
FROM W_Data_SA_Download RIGHT JOIN R_Project_AllTaskDates ON W_Data_SA_Download.ProjectID = R_Project_AllTaskDates.[Project Id]
WITH OWNERACCESS OPTION;
What I'd like to do is limit the number of records based upon what is in the PS field. Bottom line is I am trying to add the SA field into this query. I originally had 69023 records in this query but by adding the SA field, I now have 1499541 (the difference is - there could be multiple SA entries for each Pack Item #). I only want to pull records that have an SA entry if PS = P or A for each Pack Item # (because I am reporting only on Project ID (not Pack Item #). Basically, we are reporting at the Project ID level (and never even show Pack Item # in the report) and each Project ID could have multiple Pack Item #'s with different SA entries where PS = A, P or S. I want to see the SA entry for the A or P - not for the S. See, there is only 1 P or A for each Pack Item #.
Do I write an expression to do this - any ideas or examples would really help. I am not all that familiar with expressions and I did not develop this database so any help you could provide would be extremely appreciated. I hope I didn't make this sound too confusing.
SELECT R_Project_AllTaskDates.Program_Yr, R_Project_AllTaskDates.[Project Id], W_Data_SA_Download.[Pack Item #], W_Data_SA_Download.PS, W_Data_SA_Download.SA
FROM W_Data_SA_Download RIGHT JOIN R_Project_AllTaskDates ON W_Data_SA_Download.ProjectID = R_Project_AllTaskDates.[Project Id]
WITH OWNERACCESS OPTION;
What I'd like to do is limit the number of records based upon what is in the PS field. Bottom line is I am trying to add the SA field into this query. I originally had 69023 records in this query but by adding the SA field, I now have 1499541 (the difference is - there could be multiple SA entries for each Pack Item #). I only want to pull records that have an SA entry if PS = P or A for each Pack Item # (because I am reporting only on Project ID (not Pack Item #). Basically, we are reporting at the Project ID level (and never even show Pack Item # in the report) and each Project ID could have multiple Pack Item #'s with different SA entries where PS = A, P or S. I want to see the SA entry for the A or P - not for the S. See, there is only 1 P or A for each Pack Item #.
Do I write an expression to do this - any ideas or examples would really help. I am not all that familiar with expressions and I did not develop this database so any help you could provide would be extremely appreciated. I hope I didn't make this sound too confusing.