INNER JOIN Operation (SQL Only)

See AlsosqlInnerJoinSee                 ExamplesqlInnerJoinExample>Low


You can use an INNER JOIN operation to create an equi-join1LQIV1I, which is also known as an inner join.  Equi-joins are the most common type of join.  They combine records from two tables whenever there are matching values in a field common to both tables.

For example, you might use INNER JOIN with the Departments and Employees tables to select all the employees in each department.  In contrast, to select all departments (even if some have no employees assigned to them) or all employees (even if some are not assigned to a department), you might use a LEFT JOIN or RIGHT JOIN operation to create an outer join1LQIV1I

INNER JOIN is optional but when included is part of the FROMDQDO8P clause.

You use the following syntax to create an equi-join:

          table1 INNER JOIN table2
          ON table1.field1 = table2.field2


The arguments table1 and table2 are the names of the tables you want to join.  The arguments table1.field1 and table2.field2 identify the fields in those tables that you want to join on.  Except for numeric fields, the fields must be of the same data type17F82T4 and contain the same kind of data, but they don't have to have the same name.  You can join any two numeric fields, even if they are of different data types.  For example, you can join an Integer field and a Counter field.

The following example shows how you might join the Titles and Publishers tables on the PubID field:

SELECT Title, [Company Name]
FROM Titles, Publishers,
Titles INNER JOIN Publishers
ON Titles.PUBID = Publishers.PUBID


In this example, PUBID is the joined field, but it doesn't appear in the query output because it isn't included in the SELECT statement.  To include the joined field, enter the field name in the SELECT statementin this case, Titles.PUBID.