Can't get digits after decimal

  • I have these two tables, where I have numbers 587 and 21, I want their percentage

    Please help.

    DROP TABLE #TotalEnc

    Select count(encounter) as Encounter into #TotalEnc from #TotKneeRep ---Select * from #TotalEnc

    --select * from #TotalEnc --587

    DROP TABLE #AdmEncounter

    Select count(encounter) as AdmEncounter into #AdmEncounter from #Readmission ---select * from #AdmEncounter --21

    UPDATE #Readmission ---select * from #Readmission

    SET [% of Readmission] = (select AdmEncounter from #AdmEncounter) *100/(select Encounter from #TotalEnc )

    result is coming out in 3.000

    Which is supposed to be 3.577

    Thanks,

    Hai

  • Try making your 100 100.0

    EDIT: You are working with integers, meaning the result will be an integer. If you make one of the numbers a decimal, it will implicitly convert the result to decimal.

    Thanks,

    Jared

    Jared
    CE - Microsoft

  • Thanks a lot! It worked.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply