title: db2: how to remove the decimal from number column?
body: <p>A very simple query which work</p>
  <pre><code>select avg(price) from cars where type = 'electric';
  </code></pre>
  <p>the result is</p>
  <pre><code>1                                
  ---------------------------------
                  45000,00000000000
  </code></pre>
  <p>I want to remove the ,00000000000 to obtain</p>
  <pre><code>   1                                
      ---------------------------------
                      45000
  </code></pre>
  <p>I have tried cast and round but without success.
  I'm on Db2</p>
  <p>This nice ltrim works fine for all type of cars</p>
  <pre><code>select replace(ltrim(replace(price,'0',' ')),' ','0') from cars;
  </code></pre>
  <p>but using with avg return the string with the 00000</p>
  <pre><code>select replace(ltrim(replace(avg(price),'0',' ')),' ','0') from cars where type = 'electric';
  </code></pre>
  <p>the result is..</p>
  <pre><code>45000.00000000000
  </code></pre>
  <p>:(
  Only the , is changed.</p>