How do you do multiple joins to the same table?
Given an Address table that has both Billing and Shipping Addresses (2 records) for the same customer.
Trying the below but I get Join Expression not supported
SELECT OrderDetail.*
FROM ( ( ( OrderDetail
INNER JOIN [Order] ON OrderDetail.OrderNumber = [Order].[Order Number] )
INNER JOIN Customer ON Customer.ID = [Order].BIllingId)
INNER JOIN Customer ON Customer.ID = [Order].ShippingId)
r937
December 20, 2010, 2:48pm
2
with table aliases
SELECT something
, anything
, just_not_the_dreaded_evil_select_star
FROM ( (
OrderDetail
INNER
JOIN [Order]
ON [Order].[Order Number] = OrderDetail.OrderNumber
)
INNER
JOIN Customer AS b_cust
ON b_cust.ID = [Order].BIllingId
)
INNER
JOIN Customer AS s_cust
ON s_cust.ID = [Order].ShippingId
Thanks that worked but it took a while to see where the parenthesis go.
I kept the death star for the time being:x
Yes, I added the parentheses as in your example and it worked. Thanks!!!
I had some confusion about the number of parentheses (why 2 when there were 3 joins, etc).