title: Select only unique rows in mysql
body: <p>I want to select only rows that are unique according to the column userid from a mysql table. So if I have two rows with the same userid none of them gets selected but if its only one it gets selected.</p>
  
  <p>I use the following code:</p>
  
  <pre><code>SELECT T.id,T.name,T.userid FROM tbltest T WHERE userid NOT IN (SELECT userid FROM tbltest WHERE tbltest.id&lt;&gt;T.id);
  </code></pre>
  
  <p>Is this the fastest way to do it?</p>
  
  <p>Thanks!</p>