Hi, I' have s sql view that shows me the all the sales for a customer on the last 3 months:DebCode,Debtor,Total,Subtotal,Vat,Profit,Margin,Year,MonthMi problem is that I need one column per month but I need 2 amounts : Profit and Margin, how can I do this?I have this :|DebCode|Debtor|Margin|Profit|Year|Month|| 100 |Deb100| 25 |500.00|2014| 01 || 100 |Deb100| 15 |350.00|2014| 02 || 100 |Deb100| 15 |350.00|2014| 02 || 100 |Deb100| 25 |500.00|2014| 03 |This is my code :SELECT DebCode, Debtor, City, Sector, Year, Month, Subtotal_PES, Cost_PES, Vat_PES, Total_PES, Margin, SUM(Subtotal_PES) - SUM(Cost_PES) AS Profit, SaleRepFROM dbo.View_VK_SALES_SUMARYGROUP BY DebCode, Debtor, Year, Month, Subtotal_PES, Cost_PES, Vat_PES, Total_PES, Margin, SaleRep, City, Sector
Thank you so much...