title: Using GROUP BY in MySQL Join Table
body: <p>i have problem using JOIN between two tables, 
  Here is my table :</p>
  
  <p><strong>patient table</strong></p>
  
  <pre><code>........................................
  uid | no_mr     | name
  ........................................
  1   | 1101      | Eko
  2   | 1102      | John Doe
  </code></pre>
  
  <p><strong>visit table</strong></p>
  
  <pre><code>..............................................
  uid | vcode         | patient_id
  ..............................................
  1   | V-20130725143528  | 1
  2   | V-20130726132308  | 2
  3   | V-20130726142907  | 2
  4   | V-20130726144436  | 1 
  </code></pre>
  
  <p>How to display patient data based on visit table, 
  and sorted in descending order by visit.uid.</p>
  
  <p>Here is my query,</p>
  
  <pre><code>SELECT patient . * , visit.uid
  FROM patient
  LEFT JOIN visit ON patient.uid = visit.patient_id
  WHERE patient.uid &gt;1
  GROUP BY patient.no_mr
  ORDER BY visit.uid DESC 
  LIMIT 0 , 10
  </code></pre>
  
  <p>When i run that query, i have this value.</p>
  
  <pre><code>.......................................
  uid | no_mr     | name
  .......................................
  2   | 1102      | John Doe
  1   | 1101      | Eko
  </code></pre>
  
  <p>I want like this,  display the patient data that have new visit data.</p>
  
  <pre><code>.......................................
  uid | no_mr     | name
  .......................................
  1   | 1101      | Eko
  2   | 1102      | John Doe
  </code></pre>
  
  <p>Please help, thank you..</p>