You are on page 1of 2

Structured Query Language using MS-Access (Inner Join)

14 April 2016

Overview
A database is a collection of tables of data that bear logical relationships to each
other. You use relationships to connect tables by fields that they have in
common. A table can be part of any number of relationships, but each
relationship always has exactly two tables. In a query,a relationship is
represented by a join.
When you add tables to a query, Microsoft Office Access 2007 creates joins that
are based on relationships that have been defined between the tables. You can
manually create joins in queries, even if they do not represent relationships that
have already been defined. If you use other queries (instead of or in addition to
tables) as sources of data for a query, you can create joins between the source
queries, and also between those queries and any tables that you use as sources of
data.
Joins behave similarly to query criteria in that they establish rules that the data
must match to be included in the query operations. Unlike criteria, joins also
specify that each pair of rows that satisfy the join conditions will be combined in
the recordset to form a single row.
There are four basic types of joins: inner joins, outer joins, cross joins, and
unequal joins. This article explores each type of join you can use, why you use
each type, and how to create the joins.

Show rows where a common value exists in both of the joined tables
If you want to show only those rows that have matching values in the joined
field, you use an inner join. Access creates inner joins automatically.
Inner joins are the most common type of join. They tell a query that rows from
one of the joined tables correspond to rows in the other table, on the basis of the
data in the joined fields. When a query with an inner join is run, only those rows
where a common value exists in both of the joined tables will be included in the
query operations.
SQL syntax for an inner join
Inner joins are specified in SQL in the FROM clause, as shown below:
FROM table1 INNER JOIN table2 ON table1.field1compopr table2.field2

Example

You might also like