SQL INNER JOIN

gary5utton

New Member
Joined
Sep 28, 2004
Messages
8
Hey everyone, quick question... in an SQL INNER JOIN query, is ON the same as WHERE... is there some similarity? NOt sure when to use them in a query.

Thanks

gary
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Older style SQL used Where clause joins, New style SQL uses From clause joins. At least in Access, Where clause joins will sometimes result in Read Only recordsets.

Assume you have FName and LName tables with an LNameID as a key. The following are equivalent as far as the data they will return.

Using From clause join
Select FName.f1, LName.f1
From FName Inner Join LName
On FName.LNameID = LName.LNameID
Order By LName.f1, FName.f1

Using Where clause join
Select FName.f1, LName.f1
From FName, LName
Where FName.LNameID = LName.LNameID
Order By LName.f1, FName.f1

Where clauses can still be used to further filter your data
Select FName.f1, LName.f1
From FName Inner Join LName
On FName.LNameID = LName.LNameID
Where LName.f1 = "Smith"
Order By LName.f1, FName.f1

Good Luck!
 
Upvote 0

Forum statistics

Threads
1,221,816
Messages
6,162,148
Members
451,746
Latest member
samwalrus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top