title: Group by get first row without using join
body: <p>I have a table products:</p>
  
  <pre><code>ProductID ProductCode SupplierID
     1        WATCH         1
     2        WATCH         5
  </code></pre>
  
  <p>I want to group by product code:</p>
  
  <pre><code>SELECT ProductID, ProductCode, SupplierID 
  FROM products 
  GROUP BY ProductCode 
  ORDER BY SupplierID DESC
  </code></pre>
  
  <p>I want to display the last supplier id which is <strong>5</strong> with no where conditions, no join and no limit by 1.</p>
  
  <p>Something like the output below.</p>
  
  <pre><code>ProductID ProductCode SupplierID
     2        WATCH         5
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>Thank you!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>**Answered by Devon which is called as Noncorrelated Subquery**
  
  SELECT ProductID, ProductCode, SupplierID 
  FROM products 
  WHERE SupplierID = (SELECT SupplierID FROM products ORDER BY SupplierID DESC LIMIT 1)
  GROUP BY ProductCode 
  ORDER BY SupplierID DESC
  </code></pre>