locked
Increasing a dollar amont by a percentage RRS feed

  • Question

  • how do I increase a dollar amount by a precentage
    Tuesday, February 1, 2011 9:25 PM

Answers

  • Hi,

    Can you describe the expected resultset with table design? Do you want something similer to shown below?

    with CTE
    as
    ( select 2000 as yearNumber, 50 as amount
    union all select 2001 ,100
    union all select 2002 ,150)
    
    select a.yearNumber,((a.amount - cast(b.amount as decimal(19,4)) )/ b.amount ) * 100 as increasePercentage
    from CTE a
    inner join CTE b on a.yearNumber -1  = b.yearNumber
    
    


    -Chintak (My Blog)

    Tuesday, February 1, 2011 10:38 PM
  • how do I increase a dollar amount by a precentage
    DECLARE @Amount MONEY = 1
    
    SET	@Amount = @Amount * 1.15
    
    SELECT @Amount
    
    increase by 15%
    Vishal Gajjar
    Wednesday, February 2, 2011 2:39 AM

All replies

  • Hi,

    Can you describe the expected resultset with table design? Do you want something similer to shown below?

    with CTE
    as
    ( select 2000 as yearNumber, 50 as amount
    union all select 2001 ,100
    union all select 2002 ,150)
    
    select a.yearNumber,((a.amount - cast(b.amount as decimal(19,4)) )/ b.amount ) * 100 as increasePercentage
    from CTE a
    inner join CTE b on a.yearNumber -1  = b.yearNumber
    
    


    -Chintak (My Blog)

    Tuesday, February 1, 2011 10:38 PM
  • how do I increase a dollar amount by a precentage
    DECLARE @Amount MONEY = 1
    
    SET	@Amount = @Amount * 1.15
    
    SELECT @Amount
    
    increase by 15%
    Vishal Gajjar
    Wednesday, February 2, 2011 2:39 AM
  • Any progress?
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    Sunday, February 13, 2011 10:44 PM