Databases Reference
In-Depth Information
and, as requested by the clause
ON C.ContactID = I.ContactID
, it's joining the
Contact
and
Individual
tables first.
SELECT
FirstName
,
LastName
FROM
Person
.
Contact
AS
C
JOIN
Sales
.
Individual
AS
I
ON
C
.
ContactID
=
I
.
ContactID
JOIN
Sales
.
Customer
AS
Cu
ON
I
.
CustomerID
=
Cu
.
CustomerID
WHERE
Cu
.
CustomerType
=
'I'
OPTION
(
FORCE
ORDER
)
Listing 7-14.
In the next query, we are creating a right-deep tree (just to demonstrate that it's possible),
as we are requesting to join the
Individual
and
Customer
tables first, as requested
by the
ON I.CustomerID = Cu.CustomerID
clause. The resulting execution plan is
shown on Figure 7-10.
SELECT
FirstName
,
LastName
FROM
Person
.
Contact
AS
C
JOIN
Sales
.
Individual
AS
I
JOIN
Sales
.
Customer
AS
Cu
ON
I
.
CustomerID
=
Cu
.
CustomerID
ON
C
.
ContactID
=
I
.
ContactID
WHERE
Cu
.
CustomerType
=
'I'
OPTION
(
FORCE
ORDER
)
Listing 7-15.