title: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
body: <p>I have a table "campaign_items" with the columns (budget, spent) and I want to calculate the remaining budget using the formula
  remaining budget = budget - spent</p>
  
  <p>Right now I am running below query :</p>
  
  <pre><code>select distinct a.budget,a.spent 
  from campaign_items a 
  where campaign_item_id=12345 
  order by a.budget-a.spent
  </code></pre>
  
  <p>But I am getting the error :</p>
  
  <blockquote>
    <p>ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list</p>
  </blockquote>
  
  <p>Note : I cannot remove the <code>DISTINCT</code> keyword from the query because query is generated using JdbcTemplate</p>
  
  <p>Could anyone help me to sort out this error?</p>