I have a table like below
    -------------------------------------
   | Date      | EventName | Occurrences|
   --------------------------------------
   | 4/30/2019 | Party     | 20         |
   | 4/30/2019 | Reunion   | 10         |
   | 4/30/2019 | Auction   | 5          |
   | 4/30/2019 | Party     | 10         |
   | 4/30/2019 | Reunion   | 10         |
   --------------------------------------
If I run a query like this
SELECT Date, EventName, SUM(Occurrences)
FROM [dbo].[Mytable]
GROUP BY Date, EventName
ORDER BY Date DESC
I get a result similar to this...
   | Date      | EventName | Occurrences|
   --------------------------------------
   | 4/30/2019 | Party     | 30         |
   | 4/30/2019 | Reunion   | 20         |
   | 4/30/2019 | Auction   | 5          |
How can I transform the rows into Columns so my result looks more like this?
   | Date      | Party     | Reunion    | Auction |
   ------------------------------------------------
   | 4/30/2019 | 30        | 20         |    5    |
I don't know how to transform rows into columns but what I have tried so far is to query for each EventName and then join them. I think this is not optimal at all but I haven't been able to figure out a better way.
 
     
    