title: Oracle SQL: manipulating group
body: <p>I have a simple query such as this</p>
  
  <pre><code>select duration, host from Jobs
  group by host;
  </code></pre>
  
  <p>i want it actually group by a pool of hosts which is something that needs to be defined at query time</p>
  
  <p>for example, host01-10 would be pool1, host11-20 would be pool2, etc.</p>
  
  <p>at the moment, there isnt a field which says what pool it is in and but it needs to be derived from the host field.</p>
  
  <p>how do i achieve that? I want to be able to creation some sort of function on the slide to maniuplate the field so that it is group-able</p>
  
  <pre><code>def get_pool(host):
     if get_hostnumber(host) &lt; 10:
          return 'pool1'
      elif:
          ...
  
  select duration, get_pool(host) from Jobs
  group by get_pool(host);
  </code></pre>