Getting two counts and then dividing them

后端 未结 5 1502
攒了一身酷
攒了一身酷 2021-02-08 01:17

I am attempting to get two counts and then divide those two counts to get the ratio of the items I am counting. I saw this post here and tried that. I am getting an error in my

5条回答
  •  感情败类
    2021-02-08 02:19

    It's truncating due to integer division. You can perform regular division by casting.

    INSERT INTO @TABLE1
    SELECT
    A.NUM, A.DENOM, CAST(A.NUM AS FLOAT)/A.DENOM 
    

提交回复
热议问题