title: SQL - combine UNION and SORT BY for several statements
body: <p>I have a list of 100.000 User which I need to query for email domain and score for 10000 each. It is needed to take all with score 4 first. If there are not enough go to score 3 and so on.Meaning a priorization query The solution I received is working fine for one statement</p>
  
  <pre><code>SELECT TOP 10000 * 
  FROM [table] 
  WHERE Email like '%@test.com' and score in ( 1, 2, 3, 4) 
  order by score desc
  </code></pre>
  
  <p>as soon as I am trying to use that for multiple statements I receive invalid syntax errors:</p>
  
  <pre><code>SELECT TOP 10000 * FROM 
  [table] 
  WHERE Email like '%@test.com'and score in ( 1, 2) 
  order by score desc 
  UNION 
  SELECT TOP 1000 * FROM
  [table] WHERE Email like '%@test2.com' and score in ( 1, 2, 3, 4)
  order by score desc
  </code></pre>
  
  <p>I would need to be able to add as many EMAILS as I want. Help is higly appreciated :)</p>