I have a table having timestamp column (c_created_time).
While firing a select query using c_created_time in select and also same column in where clause it shows inaccurate result.
And
When i use min function with same where clause as above query it shows different result which is accurate (as expected).
2nd query output is correct.
Note: Minimum value in this table for timestamp column is “2020-06-13 00:00:00” (expected value)
=================
Table info
==================
show create table abc \G*************************** 1. row *************************** Table: abcCreate Table: CREATE TABLE abc
( c_id
bigint(20) NOT NULL AUTO_INCREMENT, e_id
bigint(20) NOT NULL, p_id
varchar(30) NOT NULL, c_created_time
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (c_id
,c_created_time
), KEY p_id_idx
(p_id
)) ENGINE=InnoDB;
Query 1 :
mysql> select c_created_time from abc where c_created_time>‘1990-01-01 00:00:00’ limit 1;
±--------------------+
| c_created_time |
±--------------------+
| 2020-06-17 12:52:46 |
±--------------------+
mysql>
Query 2 :
mysql> select min(c_created_time) from abc where c_created_time > ‘1990-01-01 00:00:00’;
±--------------------+
| min(c_created_time) |
±--------------------+
| 2020-06-13 00:00:00 |
±--------------------+
Thank you.