title: sql ORDER BY multiple values in specific order?
body: <p>Ok I have a table with a indexed key and a non indexed field. 
  I need to find all records with a certain value and return the row.
  I would like to know if I can order by multiple values.</p>
  
  <p>Example:</p>
  
  <pre><code>id     x_field
  --     -----
  123    a
  124    a
  125    a
  126    b
  127    f
  128    b
  129    a
  130    x
  131    x
  132    b
  133    p
  134    p
  135    i
  </code></pre>
  
  <p>pseudo: would like the results to be ordered like this, <code>where ORDER BY x_field = 'f', 'p', 'i', 'a'</code></p>
  
  <pre><code>SELECT *
  FROM table
  WHERE id NOT IN (126)
  ORDER BY x_field 'f', 'p', 'i', 'a'
  </code></pre>
  
  <p>So the results would be:</p>
  
  <pre><code>id     x_field
  --     -----
  127    f
  133    p
  134    p
  135    i
  123    a
  124    a
  125    a
  129    a
  </code></pre>
  
  <p>The syntax is valid but when I execute the query it never returns any results, even if I limit it to 1 record. Is there another way to go about this?</p>
  
  <p>Think of the x_field as test results and I need to validate all the records that fall in the condition. I wanted to order the test results by failed values, passed values. So I could validate the failed values first and then the passed values using the ORDER BY.</p>
  
  <p>What I can't do:</p>
  
  <ul>
  <li>GROUP BY, as I need to return the specific record values</li>
  <li>WHERE x_field IN('f', 'p', 'i', 'a'), I need all the values as I'm trying to use one query for several validation tests. And x_field values are not in DESC/ASC order</li>
  </ul>
  
  <p>After writing this question I'm starting to think that I need to rethink this, LOL! </p>