title: Using Aggregate function in where clause and a different column criteria
body: <pre><code>select PO_Order_Qty, Avg([PO_Order_Qty])as totalAverage 
  FROM [FirstStrike_Retail].[custom].[Whse_Pricing_QR]    
  where item_code ='111' and PO_order_qty &lt;(Avg([PO_Order_Qty])*2)
  group by PO_Order_Qty
  </code></pre>
  
  <p>I am using the above sql in MS Sql to get the average on a particular item codes order qty. I am expecting only one return value.</p>
  
  <p>And i need to eliminate if any of the qty is above twice the average. </p>
  
  <p>Thanks
  Xplr</p>