title: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
body: <p>I have a table Vulnerabilities from which I want to query records ordered by severity (column).
  Severity column holds value "High", "Medium","low". </p>
  
  <p>The below given query is giving me error:</p>
  
  <blockquote>
    <p>for SELECT DISTINCT, ORDER BY expressions must appear in select list"</p>
  </blockquote>
  
  <pre><code>SELECT DISTINCT vuln 
  FROM Vulnerabilities vuln 
  WHERE (lower(vuln.dsc) LIKE '%tomcat%') 
  ORDER BY CASE vuln.severity 
              WHEN 'High' THEN 1 
              WHEN 'Medium' THEN 2 
              WHEN 'Low' THEN 3 
           END ASC
  </code></pre>