title: How to calculate query result on the bases of percentage
body: <p>I want to calculate query result on the bases of percentage, which is set from the admin panel of the website.
  There are four status for the same.
  Gold, Silver,Bronze and Medellin.
  My current formula is </p>
  
  <pre><code>select * , isnull( CASE WHEN RowNumber &lt;=  (@totaltopPromoters*@Gold/100) Then 1
                         WHEN RowNumber &gt;= (@totaltopPromoters*@Gold/100) and RowNumber &lt;= (@totaltopPromoters*@Gold/100) + (@totaltopPromoters*@Silver/100) THEN 2 
                         WHEN RowNumber&gt;=(@totaltopPromoters*@Silver/100) and RowNumber&lt;= (@totaltopPromoters*@Gold/100)+(@totaltopPromoters*@Silver/100)  + (@totaltopPromoters*@Bronze/100)THEN 3 
                         WHEN RowNumber&gt;=(@totaltopPromoters*@Medallion/100) and RowNumber &lt;= (@totaltopPromoters*@Gold/100)+(@totaltopPromoters*@Silver/100)  + (@totaltopPromoters*@Bronze/100)+(@totaltopPromoters*@Medallion/100) THEN 4
                         end ,0) as  
                      TrophyType
  </code></pre>
  
  <p>Can anyone guide me on this?</p>