Hi All
Is there any way I can have an outer join that only joins onto a single record.
I.e.
I am selecting data from my customer table but also want to include data from their last order.
so
If this cannot be done, what would be the best approach?
I thought about using UDF's but that just seems far too inefficient as I would have to call one UDF for each field I wanted from the Order table.
TIA
Smeat
Is there any way I can have an outer join that only joins onto a single record.
I.e.
I am selecting data from my customer table but also want to include data from their last order.
so
Code:
Select C.Title, C.FirstName, C.LastName, O.OrderDate AS LastOrderDate, O.OrderTotal AS LastOrderTotal
FROM
Customer C
LEFT OUTER JOIN
Order O
ON
C.[ID] = O.CustomerID
If this cannot be done, what would be the best approach?
I thought about using UDF's but that just seems far too inefficient as I would have to call one UDF for each field I wanted from the Order table.
TIA
Smeat