Posted by: tahir
SQL Help - 26/01/2011 12:52
I'm trying to join 2 tables which hold values different;y, ol holds them at a PER STYLE level, sa holds them at a PER STYLE/SIZE/COLOUR level, how do I show the sum of the quantity field in sa?
As with most techy things I'm not the sharpest tool, so would appreciate a simple solution (if poss)
Sql Query:
select ol.Order_Number as SO, ol.Order_Line_Number as Line, ol.Style, ol.Customer, CONVERT(varchar(10), CONVERT(datetime, ol.Date_Created), 103) as Entered, CONVERT(varchar(10), CONVERT(datetime, ol.Delivery_Date), 103) as Delivery_Date, ol.Sales_Price as Price, ol.Total_Ordered as Ordered, ol.Total_Outstanding as Outstanding, ol.Total_Cancelled as Cancelled, ol.PO_Number as PO, ol.Customer_s_Order_Number as CustPO from order_lines11 as ol left outer join stk_aud5 as sa on ol.PO_Number = sa.Order_No and ol.Style = sa.Style where Total_Outstanding > '0' and ol.Delivery_Date < '20110101' and ol.New_Order_Type = 'F' order By ol.Customer, ol.Order_Number
As with most techy things I'm not the sharpest tool, so would appreciate a simple solution (if poss)