Saturday, September 29, 2007

Example of How to join 3 tables using inner join

alter PROCEDURE uspGetPickListDetails
@PickListId int
AS
BEGIN
SELECT PL.Weight, PL.Length,PL.Height, PL.Width, f.Carrier_Name, f.Phone,
s.SO_No, s.BillingAddress, s.ShippingAddress
FROM PickList pl inner join FreightCarriers f
on PL.ShippingMethod=f.Carrier_No inner join salesorder s on
PL.Sales_Order_No=s.Sales_Order_No where PL.Id=@PickListId
END

No comments: