title: How to give priority over one like statement in SQL
body: <p>I am building a search box that queries a database and autofills suggestions below. </p>
  
  <p>I want to be able to priorities the results in order of :</p>
  
  <p><strong>1 - Exact match</strong></p>
  
  <p><strong>2 - Starts with the same couple of letters</strong></p>
  
  <p><strong>3 - Contains the string somewhere within the database</strong></p>
  
  <p>I have a SQL statement</p>
  
  <pre><code>SELECT * 
  FROM Products 
  WHERE ProductName LIKE ? 
  OR ProductName LIKE ? 
  GROUP BY ProductName 
  ORDER BY ProductName ASC 
  LIMIT 10
  </code></pre>
  
  <p>In an example for searching for the word "computer"</p>
  
  <p>When typing "co" it should show</p>
  
  <ul>
  <li><strong>co</strong> -co</li>
  <li><strong>co</strong> mputer</li>
  <li><strong>co</strong> mputer desk</li>
  <li>ac <strong>co</strong> unt</li>
  </ul>
  
  <p>but when furthering the search to "computer"</p>
  
  <ul>
  <li><strong>computer</strong></li>
  <li><strong>computer</strong> deks</li>
  </ul>
  
  <p>The first binding param contains %computer% and the second contains c%omputer%</p>
  
  <p>Thanks for the help and if you need anything clarifying let me know.</p>