How to Join a Query in Access

A join is an operation in the Access relational database in which a result is drawn from two or more tables. The join may be set in the form of a relationship between the tables or it may be defined within a query. The default join in a query is known as an inner-join. The query returns results from the two tables when rows contain matching criteria. An outer-join returns results even when criteria do not match. Queries formed through the Query By Example feature determine their join type through the relationships that they discover. SQL queries enable you to specifically define the nature of your query's join.

Things You'll Need

  • Microsoft Access
Show More

Instructions

    • 1

      Click the "Create" tab of the "Ribbon" menu and click "Query Design" in the "Queries" section.

    • 2

      Add the tables you want to query from the "Show Table" dialog. Close the dialog by clicking "Close."

    • 3

      Click the "SQL" button in the lower right corner of the Access window. Your view will switch to the SQL editor.

    • 4

      Type your query with a join. As an example, consider a database that has two tables with the following structures:

      Table1 Table2

      ID ID

      Title PricePoint

      Price PriceDescription

      The data in fields Price and PricePoint are the join qualifier between the two tables. To query the tables with an inner-join, type the following query into the SQL editor:

      SELECT * FROM Table1 INNER JOIN Table1 ON Table1.Price = Table2.PricePoint;

      An outer-join query will return all records from one side or the other of the query, even if matching values are not found on the other side. The query example that follows will return all rows from Table1 even if the Price does not match a PricePoint in Table2:

      SELECT *FROM Sheet1 LEFT JOIN Table1 ON Sheet1.Price = Table1.PricePoint;

    • 5

      Save the query to retain your work by pressing "Ctrl-S" or clicking on the "Save" button in the quick access toolbar.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured