Quantcast
Channel: Answers for "how to store value of avg(col1) into col2 in same table"
Browsing latest articles
Browse All 4 View Live

Answer by Matt Whitfield

That doesn't make any sense - why would you want to store the average value of multiple rows into a single row, or repeat the value multiple times?Senseless as it is, the code would be:UPDATE table SET...

View Article


Answer by TimothyAWiseman

As always Matt's answer is excellent. Just for the sake of options, you could use a computer column. Something like:create function dbo.restavg(@restname varchar(128)) returns float as begin return...

View Article

Browsing latest articles
Browse All 4 View Live