Nth root of a number

  • Hi,

    I am trying to calculate CAGR which when computed for two years, the formula is (Annual Turnover ^ 1/2)-1 and when computed for three years, the formula is (Annual Turnover ^1 / 3)-1 and when computed for four years, the formula is (Annual Turnover ^ 1/4)-1.

    So, Can anybody suggest me how we can get the nth root of a number in SQL? I tried using power(Annual Turnover,(1/n)). It doesn't work.

    Thanks in advance,

    Valli

  • SELECT POWER(27.0E, 1.0E / 3.0E)

    Beware of integer division.


    N 56°04'39.16"
    E 12°55'05.25"

  • Hi,

    Thank you. It works fine.But if I would like to decide whether it is for 2 years or three years dynamically by finding the difference between the years, How do I do it?

  • See my article here about how to work with DATEDIFF function

    Datediff function demystified


    N 56°04'39.16"
    E 12°55'05.25"

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

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