title: SELECT one row per COLUMN value
body: <p>I have a table like so:</p>
  
  <pre><code>id  |  subscriber_id  |  var_name  |  var_value        | created
  1   |  35             |  last_name |  Smith            | [TIMESTAMP]
  2   |  35             |  city      |  New York         | [TIMESTAMP]
  3   |  35             |  city      |  Boston           | [TIMESTAMP]
  </code></pre>
  
  <p>In this case, let's say that the row where <code>var_value=Boston</code> has a later timestamp than the <code>var_value=New York</code> row, and thus we will be selecting the <code>Boston</code> row.</p>
  
  <p>I have tried something like this, but it sometimes says something about non-aggregate column grouping.</p>
  
  <pre><code>      SELECT
          var_name, var_value
        FROM
          subscriber_vars
        WHERE
          subscriber = ?
        GROUP BY subscriber
        ORDER BY
          created DESC
  </code></pre>
  
  <p>So in this case, an expected output would be:</p>
  
  <pre><code>[
      'last_name'  =&gt;  'Smith'
      'city'       =&gt;  'Boston'
  ]
  </code></pre>