IT tutorials
 
Office
 

Microsoft Access 2010 : Enhancing the Queries That You Build - Working with Outer Joins

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
12/5/2014 3:40:06 AM

Outer joins are used when you want the records on the one side of a one-to-many relationship to be included in the query result, regardless of whether there are matching records in the table on the many side. With a Customers table and an Orders table, for example, users often want to include only customers with orders in the query output. An inner join (the default join type) does this. In other situations, users want all customers to be included in the query result, regardless of whether they have orders. This is when an outer join is necessary.

Establish an Outer Join

To establish an outer join, you must modify the join between the tables included in the query:

1.
Double-click the line joining the tables in the query grid.

2.
The Join Properties window appears (see Figure 1). Select the type of join you want to create. To create an outer join between the tables, select Option 2 or Option 3. Notice in Figure 1 that the description is Include All Records from Orders and Only Those Records from Order Details Where the Joined Fields Are Equal.

Figure 1. Establishing a left outer join.


3.
Click OK to accept the join. An outer join should be established between the tables. Notice that the line joining the two tables now has an arrow pointing to the many side of the join.

The SQL statement produced when this change is made looks like this:

SELECT Customers.CustomerID, Customers.CompanyName
FROM Customers
LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

You can use an outer join to identify all the records on the one side of a join that don’t have any corresponding records on the many side. To do this, simply enter Is Null as the criteria for any required field on the many side of the join. A common solution is to place the criteria on the foreign key field. In the query shown in Figure 2, only customers without orders are displayed in the query result.

Figure 2. A query showing orders without order details.


 
Others
 
- Microsoft Access 2010 : Enhancing the Queries That You Build - Creating Totals Queries
- Microsoft Access 2010 : Enhancing the Queries That You Build - Using Aggregate Functions to Summarize Numeric Data
- Microsoft Project 2010 : Setting Up Project for Your Use - Defining Custom Fields
- Microsoft Project 2010 : Setting Up Project for Your Use - Defining Calendars (part 2) - Setting Project and Resources Calendar
- Microsoft Project 2010 : Setting Up Project for Your Use - Defining Calendars (part 1) - Calendar Hierarchy , Modifying and Defining Base Calendars
- Microsoft Visio 2013 : Creating a New Diagram - Connecting shapes with lines
- Microsoft Visio 2013 : Creating a New Diagram - Resizing and repositioning shapes
- Microsoft PowerPoint 2010 : Working with Charts - Modifying and Formatting Charts (part 3) - Formatting Charts
- Microsoft PowerPoint 2010 : Working with Charts - Modifying and Formatting Charts (part 2) - Modifying Your Chart’s Layout
- Microsoft PowerPoint 2010 : Working with Charts - Modifying and Formatting Charts (part 1) - Modifying Chart Design
 
Youtube channel
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS