hql = "select itembill.item.itemType.itemTypeName,itembill.item.itemName,sum(itembill.count) sum(itembill.price),itembill.addTime from baopeng.server.entity.ItemBill itembill where itembill.billState<>1 and itembill.endTime>=:beginTime and itembill.endTime<=:endTime group by itembill.item,itembill.addTime";
在程序里这样写hql查出来的sum(itembill.price)的结果是215.59999999999997 和30,而直接在数据库里面写select round (sum( itembill.price) ,2) from sn_itembill itembill where itembill.billState<>1 and itembill.endTime>='2012-06-01 00:00:00' group by itembill.addTime;是215.60和30;
price字段里面的数据都是两位的,为什么在程序里面写的会出现这种无限小数
在程序里这样写hql查出来的sum(itembill.price)的结果是215.59999999999997 和30,而直接在数据库里面写select round (sum( itembill.price) ,2) from sn_itembill itembill where itembill.billState<>1 and itembill.endTime>='2012-06-01 00:00:00' group by itembill.addTime;是215.60和30;
price字段里面的数据都是两位的,为什么在程序里面写的会出现这种无限小数
解决方案 »
- JavaEE的前端可以使用html吗
- 关于struts2的token和session的问题?
- PD生成测试数据的问题
- jms 的简单应用中遇到的问题,困扰我很久了
- 关于搜索页码分页显示!急,请帮帮忙!
- getParameter()和getParameterValues()问题
- 关与JAVA实现文件上传下载的问题
- 困扰了我很久的问题,渴望大家给解决一下,好郁闷啊!
- 请教如何用java提取execl数据?
- java多线程
- openfire + spark 怎么实现量服务器之间级联?
- 求助 The encoding 'GBK' is not supported by the Java runtime
select sum( itembill.price) from sn_itembill itembill where itembill.billState<>1 and itembill.endTime>='2012-06-01 00:00:00' group by itembill.addTime;结果也是215.59999999999997 我要问的是为什么会出现这种小数,还有在hql里面加round (sum( itembill.price) ,2),为什么直接取到整数了