• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Sum of Decimal confusion

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a DB column of decimal type decimal(5,2) in mysql database

Now i want to display the sum of the values...i'm using JOOQ

i tried the following

# select sum(col) ---> returns integer value - no decimal
# select round(sum(col), 2) --> returns the value. however it rounded off the value

Links referred for reference
https://stackoverflow.com/questions/7682502/mysql-query-to-sum-decimal-numbers
https://stackoverflow.com/questions/15972257/how-to-get-simple-sum-with-jooq
https://www.jooq.org/doc/3.3/manual-single-page/#round-function

I'm not sure how to fix this. Can someone help me on this?

Thanks
 
Master Rancher
Posts: 4668
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post some actual examples, of the rows being summed and the output from each of those queries.
 
    Bookmark Topic Watch Topic
  • New Topic