I have the following code:
FROM CTE_Order cte
INNER JOIN tblOrders o
ON cte.OrderId = o.Id
INNER JOIN tblOrderUnits ou
ON o.id = ou.OrderId
INNER JOIN tblOrderServiceUnits osu
ON ou.VMSUnitID = osu.UnitId
When I join ou, I get 2 identical unit identifiers. This causes Inner Join tblOrderServiceUnits to return 4 rows with 2 duplicates. I need it to return only two rows. How to use separate inner join only separate ou.id file?
Sorry for the poor explanation, but basically I'm jsut trying to figure out how INNER JOIN works with a separate subquery. If someone can give me an example of what I could understand it from there.
source
share