<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Steve&#039;s Journal &#187; mysql</title>
	<atom:link href="http://www.kf8ki.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kf8ki.com</link>
	<description>Just another day in paradise...</description>
	<lastBuildDate>Fri, 30 Jul 2010 15:38:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thought for the Day &#8211; July 21, 2009</title>
		<link>http://www.kf8ki.com/humor/thought-for-the-day-july-21-2009/</link>
		<comments>http://www.kf8ki.com/humor/thought-for-the-day-july-21-2009/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 17:12:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Geek Stuff]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sum]]></category>
		<category><![CDATA[thought for the day]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.kf8ki.com/?p=559</guid>
		<description><![CDATA[Computers never do what you want them to do, only what you tell them to do. Unless there&#8217;s a bug. Then you&#8217;re just screwed&#8230;
Grrrr&#8230; nothing like a MySql bug to really make your day.
I had need to generate a sum for a column of duration values with the type of TIME.  Orginally I used this [...]]]></description>
			<content:encoded><![CDATA[<h3 class="UIIntentionalStory_Message">Computers never do what you want them to do, only what you tell them to do. Unless there&#8217;s a bug. Then you&#8217;re just screwed&#8230;</h3>
<p>Grrrr&#8230; nothing like a MySql bug to really make your day.</p>
<p>I had need to generate a sum for a column of duration values with the type of TIME.  Orginally I used this as part of my query:</p>
<p>sum(call_duration) as totalhours</p>
<p>Turns out this does not work properly and has apparently been a problem since 2005!</p>
<p><a href="http://bugs.mysql.com/bug.php?id=12108" target="_blank">http://bugs.mysql.com/bug.php?id=12108</a></p>
<p>From reading the comments, there appears to be some argument as to the validity of the bug.  For what it&#8217;s worth, I found that the problem is more pronounced with more results.  I found that it was non-existant (that is that the sum returned the correct value) with result sets with only a few rows.   The problem seemed to get more severe based on more rows in the results.  In my case, a result set with about 2000 rows in it had an error of on the order of three hours.</p>
<p>The work around is to modify the query slightly:</p>
<p>sum(TIME_TO_SEC(crf_call_duration)) as totalhours</p>
<p>This converts the time to essentially an integer which is then properly handled by the sum.  You can then either work with the result as a count of seconds, or use the function SEC_TO_TIME to convert it back to a TIME value.</p>
<p>I hope this helps someone else.  It cost me a number of hours&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kf8ki.com/humor/thought-for-the-day-july-21-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thought for the day &#8211; 6-7-2009</title>
		<link>http://www.kf8ki.com/humor/thought-for-the-day/</link>
		<comments>http://www.kf8ki.com/humor/thought-for-the-day/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 12:55:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.kf8ki.com/?p=531</guid>
		<description><![CDATA[&#62; SELECT * FROM users WHERE clue &#62; 0
0 rows returned
(Tagline from a forum post)
Yeah&#8230; thats what kind of day I&#8217;m having too.
]]></description>
			<content:encoded><![CDATA[<p><span style="color: purple;"><span style="font-family: Courier New;">&gt; SELECT * FROM users WHERE clue &gt; 0<br />
0 rows returned</span></span></p>
<p>(Tagline from a forum post)<br />
Yeah&#8230; thats what kind of day I&#8217;m having too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kf8ki.com/humor/thought-for-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
