title: SQL Assign "co-efficients" to query conditions and use them to sort result
body: <p>I saw a query once that assigned some kind of ranking to query conditions, I can't remember it now.</p>
  
  <p>They way I understood it, i think variable names (s1,s2,...)  were assigned to each of the conditions with a coefficient to give them different "weights" then the sum of the variables was used to sort the result.  </p>
  
  <p>It looked something like this:</p>
  
  <pre><code>SELECT 
    * 
  FROM 
    table_name 
  WHERE condition1='value1' as (s1*3) 
     OR condition2='value2' as (s2*2) 
     OR condition3='value3' as (s3*1) 
  ORDER BY (s1+s2+s3)
  </code></pre>
  
  <p>So, the different numbers sort of give the conditions varying degrees of importance in the ORDER, makes it perfect for doing a related product/post search.</p>
  
  <p>Please, does anyone know the right structure for this query?</p>