Adding columns together to equal value in another column

  • I am wondering is there a way that the values in column 1, 2, 3, and 4 can be added together and divided by 4 and then the answer be the value for column 5? How would it be done.

  • Sounds like you want to create a computed column. For learning how to do this read the following:

    http://msdn.microsoft.com/en-us/library/ms191250.aspx

    If the above is not sufficient, please post the table definiton, along with some sample data, and desired results. To do this quickly and easily please click on the first link in my signature block. The article contains the T-SQL used to post what I have requested simply and rapidly

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Something like this:

    Select Col1, Col2, Col3, (Col1 + Col2 + Col3)/Col3 As Col5 From TableName

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

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

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