-- ORDER_TIME datetime NOT NULL(字段类型)SELECTso.`ID`,so.`ORDER_TIME`,NOW(),CONCAT(ROUND(TIMESTAMPDIFF(MINUTE,so.`ORDER_TIME`,NOW())/60,1),'') AS hourLaterFROM se_seal_order soWHERE so.id=#{orderId};
select num ,cast(round(convert(float,isnull((a.Sum_Num-d.Sum_Num),0))/convert(float,c.Sum_Store_Num)*100,1) as varchar(50))+'%' as 報告 from FORM 做除法运算,分母不为0,round函数保留一位小数.cast函数强制类型转换,转成字符串类型,然后与'%'进行字符串拼接. sql中换行符的使用: SQL本身并不使用换行符,因为换行符就跟空格符和回车符一样都
4种方法,都是四舍五入,例: import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; public class format { double f = 111231.5585; public void m1() { BigDecimal bg = new BigDecimal(f); double f1 = bg.setScale(2, BigDecimal.ROUND