Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Time anomaly in mysql table version 5.5.62-log

$
0
0

Hello there,

I need your help.

This is part of my table on MySQL database

enter image description here

I realized that in this case more than one hour has passed between the previous and the next row

mysql> SELECT
	TIMEDIFF(
		'2020-04-20 16:00:00',
		'2020-04-20 14:58:56'
	);+------------------------------------------------------------------+
| TIMEDIFF(
		'2020-04-20 16:00:00',
		'2020-04-20 14:58:56'
	) |+------------------------------------------------------------------+
| 01:01:04                                                         |+------------------------------------------------------------------+
1 row in set

mysql> 

this is not possible because the data is downloaded maximum from the source every five minutes

I have tried this query without success because the return is all zero

SELECT
	`sDatetime`,
	`sElement`,
	`sDescri`,
	MAX(
		TIME_TO_SEC(
			TIMEDIFF(
				`sDatetime`,
				`sDatetime`
			)
		)
	) AS 'Worst',
	MIN(
		TIME_TO_SEC(
			TIMEDIFF(
				`sDatetime`,
				`sDatetime`
			)
		)
	) AS 'Best',
	AVG(
		TIME_TO_SEC(
			TIMEDIFF(
				`sDatetime`,
				`sDatetime`
			)
		)
	) AS 'Average'
FROM
	tbl_2020
GROUP BY
	`sDatetime`,
	`sElement`,
	`sDescri`;

how can i find this anomaly in mysql table?

my version of MySQL is 5.5.62-log

 the name of column is sDatetime the type is Datetime.

I need extract all rows when the datediff from rows is more than an hour... the example is in question

any suggestion, please?

thanks in advance for any help


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>