how to calculate prevalence using sql code

前端 未结 3 504
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 04:36

I am trying to calculate prevalence in sql. kind of stuck in writing the code. I want to make automative code.

I have check that I have 1453477 of sample size and numbe

3条回答
  •  无人共我
    2021-01-28 05:12

    You can cast by

    count(...)/count(...)::numeric(6,4) or

    count(...)/count(...)::decimal

    as two options.

    Important point is apply cast to denominator or numerator part(in this case denominator), Do not apply to division as

    (count(...)/count(...))::numeric(6,4) which again results an integer.

提交回复
热议问题