您好我有一个mysql表,它包含类似的内容
HISTORY
===================
2013-07-01 16:23:43
2013-07-01 17:32:11
2013-07-01 20:44:22
2013-07-02 23:65:12
2013-07-03 10:23:32
2013:07-03 12:54:02
and etc........
例如前三行是2013-07-01 16:23:43,2013-07-01 17:32:11,和 2013-07-01 20:44:22此历史中最新日期是2013-07-01 20:44:22
所以我真正想要的是..有什么方法可以做出像这样的结果的选择
HISTORY
===================
2013-07-01 20:44:22
2013-07-02 23:65:12
2013:07-03 12:54:02
etc....
谢谢
答案 0 :(得分:4)
尝试此查询
select date(history) as dat,
max(history)
from table1
group by dat
| DAT | MAX(HISTORY) |
-------------------------------------------------------------
| July, 01 2013 00:00:00+0000 | July, 01 2013 20:44:22+0000 |
| July, 02 2013 00:00:00+0000 | July, 02 2013 23:59:12+0000 |
| July, 03 2013 00:00:00+0000 | July, 03 2013 12:54:02+0000 |
答案 1 :(得分:0)
也许它可以像那样;
select Max(history) as MyMaxTimeForADay from MyTime t1 group by Date(t1.history);
您可以看到此链接的工作原理:http://sqlfiddle.com/#!2/12be2/2/0