natetheblade2
New Member
- Joined
- Apr 20, 2016
- Messages
- 4
Hi All,
I am not a super-star SQL writer or database programmer, so I am trying to figure out how to do something in Access.
I have two tables. Quarter 1 and Quarter 2. They both contain the same number and type of fields.
I would like a query that does the following:
I thought that one way to do that might be an unmatched query, but there is only an option in Access for using one variable for criteria and I want unique values based on the business unit AND the ID# in order to aggregate based on business unit since sometimes the unique ID# will change business units between quarters.
I then thought that a join might work, but it seems that it might leave out records from one quarter that did not appear in the other.
I then thought that a union might be appropriate, although how would that work for keeping what is in the fields of Quarter 2 in the event of a duplicate record match on business unit and ID# between the two?
Any suggestions?
I am not a super-star SQL writer or database programmer, so I am trying to figure out how to do something in Access.
I have two tables. Quarter 1 and Quarter 2. They both contain the same number and type of fields.
I would like a query that does the following:
- Return the data from both tables without duplicates based on the fields for Business Unit and UniqueID#. The other fields are irrelevant for returning without duplicates.
- When there is a conflict between what is in a field for Quarter 1 and what is in Quarter 2, the unique record returned should reflect Quarter 2 since it is the most recent.
I thought that one way to do that might be an unmatched query, but there is only an option in Access for using one variable for criteria and I want unique values based on the business unit AND the ID# in order to aggregate based on business unit since sometimes the unique ID# will change business units between quarters.
I then thought that a join might work, but it seems that it might leave out records from one quarter that did not appear in the other.
I then thought that a union might be appropriate, although how would that work for keeping what is in the fields of Quarter 2 in the event of a duplicate record match on business unit and ID# between the two?
Any suggestions?