Is there a way to return a record from a query between two related tables if a record exists in table1 but there are no related records in table2? I have a number of records in table1 that may or may not have a related record in table2 and I would like my query to find all records in table1 with the associated related records but also get records from table1 with no related records in table2.
So in table1 I have a one to many relationship between RecordID and NameID in table2. Note that table2 has no related record for id#3 (Bill)
Table1:
Code:
RecordID|Name
1|Jim
2|Dave
3|Bill
4|Rick
Table2
Code:
DetailID|NameID|Car
1|1|Buick
2|1|Dodge
3|2|Chevy
4|2|Ford
5|4|Honda
6|4|Toyota
When I run a simple select query
Code:
SELECT Table1.RecordID, Table1.Name, Table2.Car
FROM Table1 INNER JOIN Table2 ON Table1.RecordID = Table2.NameID;
I get the following result:
Code:
RecordID|Name|Car
1|Jim|Buick
1|Jim|Dodge
2|Dave|Chevy
2|Dave|Ford
4|Rick|Honda
4|Rick|Toyota
Is there any way to get RecordID 3 (Bill) to show in a query even though he has no related records in Table2?
Thanks much.