use PIVOTSELECT m.warehouse,m.productlist,m.January AS JanPrice,n.January AS JanCost,m.February AS FebPrice,n.February AS FebCost,...FROM (select warehouse, productlist, January,February ,.. from table pivot(price for month in (January,February,...))p ) mINNER JOIN (select warehouse, productlist, January,February ,.. from table pivot(cost for month in (January,February,...))p ) nON n.warehouse = m.warehouseAND n.productlist = m.productlist
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/