title: SQL Query Using Then(?) Or a points system
body: <p>I am building a user search and I have a Users table with id, first, and last in it.</p>
  
  <p>I then query a names, say: "John Smith".</p>
  
  <p>Using PHP I'll break the query into 2 parts: q1 = John and q2 = Smith.</p>
  
  <p>I want to devise a points system where the record that has first = John and last = Smith gets pulled to the top.</p>
  
  <p>So my sql is something like this:</p>
  
  <pre><code> SELECT User.id, User.first, User.last
   FROM users as User
   WHERE (User.first = q1 OR User.first = q2) OR //if this is true +1 points
   WHERE (User.last = q1 OR User.last = q2) OR //if this is true +1 points
  
  //then sum up the points and order by it (so the User.id with John Smith will have 2 points)
  </code></pre>
  
  <p>Any suggestions?</p>