MCSA-EXAM70-461-SQL
-- OUTER JOIN
USE PORUAT;
GO
SELECT
p.personID, p.firstname, p.lastname, o.protectiveOrderID,o.UpdatedOn
FROM person p
RIGHT OUTER JOIN protectiveOrder o ON p.protectiveOrderID = o.protectiveOrderID
WHERE P.PersonTypeListID = 4
AND p.lastname = 'Smith'
or p.FirstName = 'William'
and o.UpdatedOn is null;
SELECT
p.personID, p.firstname, p.lastname, o.protectiveOrderID,o.UpdatedOn
FROM person p
If person.Rows.Count > protectiveOrder.Rows.Count
Then
' Left Join
Else
' Right Join
End If;
LEFT OUTER JOIN protectiveOrder o ON p.protectiveOrderID = o.protectiveOrderID
USE PORUAT;
GO
If person.Rows.Count > protectiveOrder.Rows.Count
Then
' Left Join
Else
' Right Join
End If;
No comments:
Post a Comment