SELECT A.PinCode
      ,A.Location
      ,A.Year
      ,SUM(CASE
             WHEN A.Area IN ('North Chennai', 'South Chennai') THEN
              A.Amount
             ELSE
              0
           END) AS total_amount_north_south
      ,SUM(CASE
             WHEN A.Area IN ('East Chennai', 'West Chennai') THEN
              A.Amount
             ELSE
              0
           END) AS total_amount_east_west
      ,SUM(A.Amount) AS Total_amount_for_Chennai
  FROM Tamilnadu 
 GROUP BY A.PinCode
	 ,A.Location
         ,A.Year

Comments are closed.