title: Selecting unique years from timestamp - results not as expected
body: <p>Trying to select unique years from timestamp column in a table but so far unsuccesful. There are about 50 rows with 3 unique years between them.</p>
  
  <pre><code>$getyears = $dbh-&gt;prepare("SELECT DISTINCT DATE_FORMAT(timestamp, '%Y') as timestamp FROM press");
  $getyears-&gt;execute();
  $years = $getyears-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  print_r($years);
  </code></pre>
  
  <p>The result of this is:</p>
  
  <pre><code>Array ( [0] =&gt; Array ( [timestamp] =&gt; ) )
  </code></pre>
  
  <p>There should be three different years.</p>
  
  <p>I'm no expert in MySQL and quite new to PDO. Can't see where I'm going wrong.</p>
  
  <p><strong>Updated</strong></p>
  
  <p>I enclosed <code>timestamp</code> with back ticks but still the same result.</p>
  
  <p>Printing the error info <code>print_r($getyears-&gt;errorInfo());</code> returned:</p>
  
  <pre><code>Array ( [0] =&gt; 00000 [1] =&gt; [2] =&gt; )
  </code></pre>
  
  <p><code>timestamp</code> is a <code>int</code> type field and after a double check, the table as a whole definitely contains 3 unique years.</p>
  
  <p><strong>Updated 2</strong></p>
  
  <p>Just a bit more info:</p>
  
  <p>All rows have either of the following in the <code>timestamp</code> field (<code>int(11)</code>):</p>
  
  <pre><code>1230587568
  1262123568
  1356817968
  </code></pre>