title: MySQL php - How can I get last 3 rows but not count duplicates
body: <p>Hello I want to get the last 3 unique rows but allow any duplicates with the same filename to also be returned. In the example below I should get 5 rows back.</p>
  
  <p>So I should get <code>visa2 f9ed287</code> <code>visa1 f9ed287</code> <code>visa f9ed287</code> <code>rose 996fa07</code> and <code>feel e96ba65</code></p>
  
  <pre><code>Emo Table
  ---------
  
  id  | s     | filename
  ----------------------
  59  | visa2 | f9ed287
  58  | visa1 | f9ed287
  57  | visa  | f9ed287
  56  | rose  | 996fa07
  55  | feel  | e96ba65
  54  | kick  | c716cea
  53  | yay   | 8e1ff5d
  </code></pre>
  
  <p>This the code I am using which does not include duplicates in the result</p>
  
  <pre><code>$statement = $pdo-&gt;prepare("SELECT s, f FROM emos
                               GROUP BY (f)
                               ORDER BY id DESC                                 
                               LIMIT 3");
  $statement-&gt;execute(array($room));
  </code></pre>