Left Outer JOIN with Exclusion

Left Outer JOIN with Exclusion
Download PDF

A LEFT OUTER JOIN with exclusion is a type of JOIN operation in SQL that combines data from two tables, based on a JOIN condition, and excludes the rows that match the JOIN condition. This type of JOIN is called an outer JOIN with exclusion because it includes the rows from the left (or first) table that do not have a matching row in the right (or second) table, and it excludes the rows from both tables that do have a matching row.

Here is an example of a LEFT OUTER JOIN with exclusion syntax:

SELECT *

FROM table1

LEFT OUTER JOIN table2

ON table1.column1 = table2.column1

WHERE table2.column1 IS NULL

In this example, the LEFT OUTER JOIN combines the rows from table1 and table2, based on the JOIN condition table1.column1 = table2.column1. The WHERE clause then excludes the rows where the table2.column1 column is not NULL, so only the non-matching rows are included in the result.

Want to learn more about join types?

JOIN Types

https://SteveStedman.com/joins

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *

*