hi
i have following sql query but i am wonder to convert into PIVOT query how it is possilbe
SELECT a.AreaID, a.AreaName, c.CustomerID, c.CustomerName, c.ProductID, c.ProductName, Sum(c.Qty) AS Qty, Sum(c.NetTotal) AS SalesValue FROM Area AS a, Parties AS b, SalesDayBook AS c WHERE a.AreaID=[b].[AreaID] AND c.CustomerID=[b].[PartyID] AND c.TransDate>='" & DateEdit1.EditValue & "' And c.TransDate<='" & DateEdit2.EditValue & "' GROUP BY a.AreaID, a.AreaName, c.CustomerID, c.CustomerName, c.ProductID, c.ProductName;
i want to show productname as a rows and areaname as a columns and in this areaname columns i want to show the qty of each product for each area
expected result is like below
ProductName area a area b area c
abc 10 0
20
def 1 4 2
ghi 5
3 10
jkl 7
15 3
please rectify my query
- Edited by haqayyum 21 hours 29 minutes ago