mysql 用sum(liezhi) -->leizhi是time类型。当好像计算出的结果不正确,不知道是怎么回事?
解决方案 »
- MySQL:LOAD DATA IN FILE出错
- ,saving disk I/O operations是前提条件还是最终结果?
- MYSQL 全文本搜索是干啥的
- mysql命令行非标准端口怎么连接?
- MySQL的Text类型字段问题
- vb怎么连mysql?
- 那位大哥能帮我转换一下数据库,小弟我不会?:)
- mysql存储的中文都是乱码
- MYSQL服务器入库效率慢的要死!使用预处理一样!
- character_set_server and character_set_database值均为latin1
- SQL统计某张表的数据问题,表内数据平均一天1千多万[高分,分不够可以加,只要能把问题解决]
- meidawiki遇到的问题,懂得进来指点一下
' and end_time!='0000-00-00 00:00:00' and card_index=1;
+-----------------+
| sum(total_time) |
+-----------------+
| 8446 |
+-----------------+
1 row in set
mysql>
select SECOND
(total_time) from balance_conf_account where start_time>'2007-01-01 00:00:00' and end_time<'2009-01-01 00:00:00' and end_time!='0000-00-00 00:00:00' and card_index=1;
+--------------------+
| SECOND(total_time) |
+--------------------+
| 0 |
| 50 |
| 12 |
| 42 |
| 42 |
+--------------------+
5 rows in set
mysql>
select MINUTE
(total_time) from balance_conf_account where start_time>'2007-01-01 00:00:00' and end_time<'2009-01-01 00:00:00' and end_time!='0000-00-00 00:00:00' and card_index=1;
+--------------------+
| MINUTE(total_time) |
+--------------------+
| 43 |
| 20 |
| 10 |
| 10 |
| 0 |
+--------------------+select HOUR
(total_time) from balance_conf_account where start_time>'2007-01-01 00:00:00' and end_time<'2009-01-01 00:00:00' and end_time!='0000-00-00 00:00:00' and card_index=1;
+------------------+
| HOUR(total_time) |
+------------------+
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
+------------------+
用第一种是8000多秒第二,第三,第四的总和才5000多点。、不知是怎么回事?