<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5336276328210987156</id><updated>2024-10-25T11:17:30.462+05:30</updated><category term="abhishek sharma"/><category term="datetime"/><category term="mysql"/><category term="second difference"/><category term="time_to_sec in mysql"/><category term="time_to_sec()"/><title type='text'>MySQL Hits/Tricks/Queries/Problems</title><subtitle type='html'>Here you can find hits/tricks/queries/problems related to Mysql and the solution to all of them.I also appreciate different problems associated with mysql from all of you!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mysqlexpert.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5336276328210987156/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://mysqlexpert.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5336276328210987156.post-3109036062005736425</id><published>2013-09-02T23:30:00.001+05:30</published><updated>2013-09-03T20:51:51.291+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="abhishek sharma"/><category scheme="http://www.blogger.com/atom/ns#" term="datetime"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="second difference"/><category scheme="http://www.blogger.com/atom/ns#" term="time_to_sec in mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="time_to_sec()"/><title type='text'>Surpassing time_to_sec() function maximum limit in Mysql</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Time_to_sec() is a very important function in mysql.We
usually use this function to convert a time value to second.But there is a maximum
limit corresponding to this function and that is 3020399 (sec.s)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now consider a case that we are having a table which
maintains the history record of a project activities and we want to find out the
average time taken by the concerned assignees in hh:mm:ss format!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here we can’t directly use time_to_sec() function here to find
out the total seconds takes by the current assigners (due to its value
limitation) to finish their work!&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So for getting the desired output first we need to calculate the days difference then multiply it with 24*60*60 to convert it into seconds and then adding time_to_sec function value like&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
DATEDIFF(start_date,end_date)*24*60*60+TIME_TO_SEC(TIMEDIFF(TIME(start_date),TIME(end_date)))
AS sec_diff &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Eg.&lt;/b&gt; Table with the name A contains following entries&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184; width: 507px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
P_ID&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;created&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;closed&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-04-01 16:05:18&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-08 16:31:04&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 2;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-2&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-05-30 15:38:19&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-29 13:08:33&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 3;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-3&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-05-29 17:41:59&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-22 21:27:33&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 4;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-4&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-06-12 16:41:34&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-26 11:48:14&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 5;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-5&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-06-12 16:02:29&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-21 06:25:34&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 6;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-6&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-06-10 16:00:24&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-14 16:19:27&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 7;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-7&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-06-13 15:18:41&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-12 17:38:14&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 8;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-8&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-07-04 10:31:23&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-09-02 07:00:34&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 9;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-9&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-07-01 18:15:33&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-30 08:10:10&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 15.8pt; mso-yfti-irow: 10; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
Ent-10&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-06-24 18:32:13&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 15.8pt; padding: 0in 5.4pt 0in 5.4pt; width: 126.8pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: right;&quot;&gt;
2013-08-22 12:14:19&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We need to find out the average time taken to complete all
these 10 entries under Project-ID column.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So,the query would be :--&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;CONCAT(SUBSTRING_INDEX(average/(24*60*60),&#39;.&#39;,1)*24+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;HOUR(SEC_TO_TIME(average-SUBSTRING_INDEX(average/(24*60*60),&#39;.&#39;,1)*24*60*60)),&#39;:&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;MINUTE(SEC_TO_TIME(average-SUBSTRING_INDEX(average/(24*60*60),&#39;.&#39;,1)*24*60*60)),&#39;:&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;SECOND(SEC_TO_TIME(average-SUBSTRING_INDEX(average/(24*60*60),&#39;.&#39;,1)*24*60*60))) AS time_average FROM&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;SELECT AVG(sec_diff) AS average FROM&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;SELECT p_id,created,closed,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;DATEDIFF(created,closed)*24*60*60+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;TIME_TO_SEC(TIMEDIFF(TIME(created),TIME(closed))) AS sec_diff&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;) AS a&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-weight: normal;&quot;&gt;) AS b&lt;/span&gt;&lt;/div&gt;
&lt;/h4&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;So it will produce the result(in hh:mm:ss) format :--&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;i&gt;&lt;b&gt;time_average&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;i&gt;&lt;b&gt;1806:35:35&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Do let me know if having any confusion related to this post.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mysqlexpert.blogspot.com/feeds/3109036062005736425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysqlexpert.blogspot.com/2013/09/surpassing-timetosec-function-maximum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5336276328210987156/posts/default/3109036062005736425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5336276328210987156/posts/default/3109036062005736425'/><link rel='alternate' type='text/html' href='http://mysqlexpert.blogspot.com/2013/09/surpassing-timetosec-function-maximum.html' title='Surpassing time_to_sec() function maximum limit in Mysql'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>New Delhi, Delhi, India</georss:featurename><georss:point>28.635308 77.22496000000001</georss:point><georss:box>28.1893855 76.579513 29.081230499999997 77.870407000000014</georss:box></entry></feed>