You need a join.
SELECT NameTable.ID,[Name],Age,location,[time],[grade],NameTable.[and so on]
FROM NameTable
INNER JOIN AdditonalTable
ON NameTable.ID=AdditionalTable.ID
WHERE [Name] = [Enter name:]
You can easily build this query in the query design window by adding both the tables and then dragging the ID field from one table to the next to create the join. Then just drag any fields you need into the design grid. You can the add criteria on the criteria line. [Enter name:]
will prompt for a name, and
WHERE [Name] = "Joe"
Will return people called Joe.
Note that Name and Time are reserved words and should not be used.
I have said NameTable.ID
, but just age
, this is because ID appears in both tables so it is essential to name the table, whereas age
only occurs in one table, it would be best to name the table in this case, but you do not have to.
More information: http://msdn.microsoft.com/en-us/library/office/bb208894(v=office.12).aspx