title: SQL Select to combine row values in output table using Pivot or CASE
body: <p>I am using a PostgreSQL database and have a table as follows:</p>
  
  <pre><code>--------------------------------------
  | Date  | MetricType  | MetricValue  |
  --------------------------------------
  | date1 | MetricA     | val          |
  --------------------------------------
  | date1 | MetricB     | val          |
  --------------------------------------
  | date1 | MetricC     | val          |
  --------------------------------------
  | date2 | MetricA     | val          |
  --------------------------------------
  | date2 | MetricB     | val          |
  --------------------------------------
  | date2 | MetricC     | val          |
  --------------------------------------
  </code></pre>
  
  <p>As you can see, each date has a set of metric types and each type has a value. I want to write a Select statement which combines this data in the following manor</p>
  
  <pre><code>------------------------------------------
  | Date  | MetricA  | MetricB  | MetricC  | 
  ------------------------------------------
  | date1 | val      | val      | val      |
  ------------------------------------------
  | date2 | val      | val      | val      |
  ------------------------------------------
  </code></pre>
  
  <p>I am not sure how to go about writing this Select statement to get these results. Can anyone help?</p>