title: MySQL order by priority list
body: <p>I need to order a table but I don't know how columns will be selected by user.</p>
  
  <p>Example:</p>
  
  <pre><code>select * 
  from table 
  order by field1, field2, field3
  </code></pre>
  
  <p>But the user can change fields order: field3, field1, field2</p>
  
  <p>I was thinking in something like that:</p>
  
  <pre><code>select * 
  from table
  order by 
  some_fuction (
  field1, priority
  field2, priority
  field3, priority
  )
  </code></pre>
  
  <p>Where I can set the priority in each field. Is it possible?</p>
  
  <p>Thanks,
  Anderson</p>