 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SQL Server 2005 query to get the average</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/mssql-query-to-get-the-average/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/mssql-query-to-get-the-average/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 23:02:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/mssql-query-to-get-the-average/#comment-60292</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Tue, 24 Feb 2009 18:38:32 +0000</pubDate>
		<guid isPermaLink="false">#comment-60292</guid>
		<description><![CDATA[Are you asking for a &quot;statement&quot; that sets the third column value to the average of the other two columns?  That isn&#039;t a &quot;query&quot; - you need to use an Update statement:

update mytable set column3 = (column1 + column2)/2;

A query does not change the values in the underlying tables.

Note - you may want to look at functions like &quot;Round&quot; or &quot;Floor&quot; if you want the average to be of a specified precision, or an integer value.

update mytable set column3 = round((column1+column2)/2, 2);]]></description>
		<content:encoded><![CDATA[<p>Are you asking for a &#8220;statement&#8221; that sets the third column value to the average of the other two columns?  That isn&#8217;t a &#8220;query&#8221; &#8211; you need to use an Update statement:</p>
<p>update mytable set column3 = (column1 + column2)/2;</p>
<p>A query does not change the values in the underlying tables.</p>
<p>Note &#8211; you may want to look at functions like &#8220;Round&#8221; or &#8220;Floor&#8221; if you want the average to be of a specified precision, or an integer value.</p>
<p>update mytable set column3 = round((column1+column2)/2, 2);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.037 seconds using memcached
Object Caching 267/273 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-26 01:11:29 -->