Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

EXCEL MATH TO SQL

Hi All,

I have below excel math :

=FLOOR(LOG(Number,2),1)+1

How to convert it into MS SQL ?

Thank you.
Avatar of Sean Stuber
Sean Stuber

floor(log(number)/log(2))+1
you could also use log10  instead of log

Avatar of emi_sastra

ASKER

Hi sdstuber,

 - floor(log(number)/log(2))+1
It works.

- you could also use log10  instead of log
How to do this ?

Thank you.
floor(log10(number)/log10(2))+1
What makes it different ?

Would you please make correction of my code below ?

SELECT FLOOR(LOG(
SELECT COUNT(*) AS TotalMember
FROM TMMEMBERDATA) / LOG(2))+1

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great.

Thank you very much for your help.