| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
|||
Combining QueriesI have run into a problem when trying to manipulate data from two tables. Basically I have two data tables one is named AFF and the other is named Balances. Neither table has a primary key because I have to import data from external sources to populate the tables. I am grouping multiple fields (Company ID #, Type Code) together to get distinct records. Both tables have many overlapping records which only differ on a field 'Source' which contains the date of the file from which the record was imported.
I would like to filter both tables for just the most recent 'Source' date for each company. I am able to do this by using the max function in a query on the 'Source' field and then using GROUP BY to isolate each company record. The problem is that when I want to combine both of my filtered tables, I am running into a problem. As there is no primary key to access the records by, I am joining the queries. This does not work very well. I am having to do this in MS Access as that is where the source data is located. Is there an easy way to assign record numbers to a query in MS Access? If so, maybe I could create my own primary key field in a temp query. |
|
Be the first to answer this question! Click on the 'Post Reply' button below.
|