当前位置: 移动技术网 > IT编程>数据库>MSSQL > postgresql常用实例分享

postgresql常用实例分享

2018年09月21日  | 移动技术网IT编程  | 我要评论

玖夜宠妾,不信你不笑 国庆七天乐,毛羽弱先摧

1.保留小数点。保留小数点,round运算时,必须加 ::numeric

select round(b.num::numeric/b.counts::numeric,4)

2.转日期格式

to_char(t.create_time, 'yyyy')

3.选择语句

case when use_money is not null and download_count is null then -1 else   round(use_money::numeric/download_count::numeric,2) end 
case when use_money is not null  then -1 else   xx end 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网