sql - How to calculate query result on the bases of percentage -


i want calculate query result on bases of percentage, set admin panel of website. there 4 status same. gold, silver,bronze , medellin. current formula

select * , isnull( case when rownumber <=  (@totaltoppromoters*@gold/100) 1                        when rownumber >= (@totaltoppromoters*@gold/100) , rownumber <= (@totaltoppromoters*@gold/100) + (@totaltoppromoters*@silver/100) 2                         when rownumber>=(@totaltoppromoters*@silver/100) , rownumber<= (@totaltoppromoters*@gold/100)+(@totaltoppromoters*@silver/100)  + (@totaltoppromoters*@bronze/100)then 3                         when rownumber>=(@totaltoppromoters*@medallion/100) , rownumber <= (@totaltoppromoters*@gold/100)+(@totaltoppromoters*@silver/100)  + (@totaltoppromoters*@bronze/100)+(@totaltoppromoters*@medallion/100) 4                        end ,0)                       trophytype 

can guide me on this?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -