Adding values in columns and creating a new field with the total

  • Hi All

    Example below

    fDay1fDay2fDay3fDay4fDay5fDay6fDay7Total

    10020000

    0.7500.500000

    0.5021.750000

    What I would like to achieve is adding the values from Fday1 to Fday7 and then populate a new field called Total

    Anny suggestions would be appreciared.

    Regards

    A

  • Why can't you just add up the 7 days and show that as the Total?

    Or do you need to update the Total column in the table?

    It would be nice if you could provide the DDL for the table, and consumable INSERTs so it will be easy for us to show you how, if this hasn't answered your question.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Hi Dwain

    "Why can't you just add up the 7 days and show that as the Total?"

    That's perfect, that is actually hat I want to do

    Its more a reporting script than an actual table insert

    thanks

    a

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

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