Reputation: 15
Table1 has ID's from Table2 and Table3. But i only want to see info from Table1 that has the same ID as Table2. I have been trying to make it work in access using SQL but have had no luck. Ive tried WHERE clauses, INNER JOINS
Table1:
ID | NAME
1 - - 2
2 - - 3
3 - - 4
4 - - 5
5 - - 6
6 - - 7
7 - - 8
8 - - 9
9 - - 10
10 - - 11
If table one looks like so, ID and NAME are both Text Values. There is more Columns in table1. But Numerical in the example for ease of use.
Table2:
ID | NAME
2 - - 3
5 - - 6
6 - - 7
7 - - 8
10 - - 11
And table two looks like so with only ID and NAME. I was wanting to see all the columns in table1 but only the rows where ID in table1 matches the ID in table2. So i am assuming i need to query table2 and grab columns from Table1 where ID = ID but for some reason it is not functioning in Access 2010.
Upvotes: 0
Views: 1061
Reputation: 8414
Create a new query. Bring in Table1 and Table2.
Click on ID in Table1 and drag onto ID in Table2.
You now have an Inner Join. By definition, it will only display records where ID exists in both tables.
Click on each field in Table1 and drag it down to the bottom (where the fields are). Do the same with Name in Table2.
You will now see all the records from Table1 and data in the Name field only where there's a matching ID from Table2 when you run the query.
Upvotes: 1