Created
January 27, 2016 09:13
-
-
Save dnasca/4e335e3cd2a1fe022d4d to your computer and use it in GitHub Desktop.
Equi vs Non-Equi Join
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
sod.SalesOrderId, | |
sod.SalesOrderDetailId, | |
sod.ProductId, | |
sod.OrderQty, | |
so.SpecialOfferId, | |
sod.ModifiedDate, | |
so.StartDate, | |
so.EndDate, | |
so.Description | |
FROM | |
Sales.SalesOrderDetail AS sod | |
INNER JOIN | |
Sales.SpecialOffer AS so | |
ON | |
so.SpecialOfferId = sod.SpecialOfferId | |
AND | |
sod.ModifiedDate < so.EndDate | |
AND | |
sod.ModifiedDate >= so.StartDate | |
WHERE | |
so.SpecialOfferId > 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment