title: PIVOT Table Date & Year wise data display sql server 2005
body: <p>this is my query</p>
  
  <pre><code>SELECT *
  FROM (SELECT CurDate, YEAR(CurDate) AS orderyear, Warranty_Info
        FROM eod_main where year(CurDate)&gt;=2009 and year(CurDate)&lt;=2011) AS D
    PIVOT(SUM(Warranty_Info) FOR orderyear IN([2009],[2010],[2011])) AS P
  </code></pre>
  
  <p>the above query return data but CurDate return date it is is return multiple date for same month.</p>
  
  <p>i want that <code>SUM(Warranty_Info)</code> should return only once for every month and year</p>
  
  <p>output should look like</p>
  
  <pre><code>Month     2009     2010    2011    2012   2013
  -----     ----     ----    ----    ----   -----
  1          10       0       11      32      98
  2          20       10      21      11      44
  3          0        224     33      77      31
  </code></pre>
  
  <p>some kind of problem is there in my query and that is why it is returning multiple data for same month like</p>
  
  <p><img src="https://i.stack.imgur.com/o7y5S.png" alt="enter image description here"></p>
  
  <p>please help me to have the right query. thanks</p>