title: SQL SUM of a Column in WHERE Clause
body: <p>I got a large table like below :</p>
  
  <pre><code>--------------------------
  OrderNo     OrderQuantity
  --------------------------
  100             250.00
  101             455.10
  102              89.55
  103             112.15
  104             330.12
  </code></pre>
  
  <p>I have to filter by SUM of OrderQuantity by less than or equal to 800.00. My SQL query is below which did not work as expected.</p>
  
  <pre><code>SELECT OrderNo, OrderQuantity
      FROM WorkOrder
          HAVING SUM(OrderQuantity) &lt;= 800
  </code></pre>
  
  <p>I expect a result like below. </p>
  
  <pre><code>--------------------------
  OrderNo     OrderQuantity
  --------------------------
  100             250.00
  101             455.10
  102              89.55
  </code></pre>
  
  <p>Can anybody help me please?</p>