mycat datetime数据类型max的问题


mysql> select * from test;      -- 样例数据
+----+-----------------------+
| id | tim                   |
+----+-----------------------+
|  1 | 2017-12-04 14:32:51.0 |
|  2 | 2017-12-04 14:32:51.0 |
|  1 | 2017-12-04 17:26:37.0 |
|  2 | 2017-12-04 17:26:37.0 |
|  3 | 2017-12-04 17:26:37.0 |
+----+-----------------------+
5 rows in set (0.14 sec)

mysql> select max(tim) from test; -- 取不出来
+------+
| MAX0 |
+------+
| NULL |
+------+
1 row in set (0.14 sec)

mysql> select id,max(tim) from test group by id;  --分组又可以,神奇
+----+-----------------------+
| id | MAX1                  |
+----+-----------------------+
|  1 | 2017-12-04 17:26:37.0 |
|  2 | 2017-12-04 17:26:37.0 |
|  3 | 2017-12-04 17:26:37.0 |
+----+-----------------------+
3 rows in set (0.14 sec)

mysql> select version();
+---------------------------------------+
| VERSION()                             |
+---------------------------------------+
| 5.6.29-mycat-1.7.0-DEV-20170416134921 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> show create table test;
+-------+-----------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                          |
+-------+-----------------------------------------------------------------------------------------------------------------------+
| test  | CREATE TABLE `test` (
  `id` int(11) DEFAULT NULL,
  `tim` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select version();
+---------------------------------------+
| VERSION()                             |
+---------------------------------------+
| 5.6.29-mycat-1.7.0-DEV-20170416134921 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> 

不敢用了。