title: Custom aggregation
body: <p>Consider a simple table in Oracle:</p>
  
  <pre><code>buySell     quantity
  --------------------
  buy         200
  sell        100
  ...
  </code></pre>
  
  <p>We want to get a net quantity of the table, positive if it's a net buy, negative otherwise. 
  How can I achieve it in one query? If possible, a general solution (usable in other DBMS) is preferred. But if there's a superior Oracle-only solution, would appreciate it if you could share it too.</p>
  
  <p>More generally a way to do custom aggregation (e.g. multiply different numbers to quantity of a record depending on values of other columns, before aggregation).</p>