Division ( / ) not giving my answer in postgresql

前端 未结 4 1725
梦谈多话
梦谈多话 2020-12-24 04:36

I have a table software and columns in it as dev_cost, sell_cost. If dev_cost is 16000 and sell_cost is 7500

4条回答
  •  渐次进展
    2020-12-24 04:48

    You can also cast your variable to the desired type, then apply division:

     SELECT (dev_cost::numeric/sell_cost::numeric);
    

    You can round your value , and specify the number of digits after point:

    SELECT TRUNC((dev_cost::numeric/sell_cost::numeric),2);
    

提交回复
热议问题