Skip to content

Inner Join

May 10, 2012

Two columns in a row in the FIRST table, Each column doing inner join with another tables.

If a specific column is not meeting the INNER join CRITERIA then that ROW of the first table is NOT included in the result set even though other columns are meeting other join criteria.

So all criteria of all columns should be met if all columns in the FIRST row are being used for INNER join.

===

What if we have inner join and outer join together on the same row but different columns.

In that case – we need to see if we can nest the JOINS or sequence them?. Do we want an inner join to happen first or do we want an outer join to happen first – for each of the columns?

Col1 | Col2

If we want that value of Col1 must exist in Table2, ID1
then,
Inner Join Table2 t2 ON table1.col1 = t2.id1

Since Left Outer join put on Table1 – will always ensure col2 is always selected, so our results here will purely be determined by col1.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: