mysql 用sum(liezhi) -->leizhi是time类型。当好像计算出的结果不正确,不知道是怎么回事?
解决方案 »
- mysql数据导出找不到表
- 大家有好的数据库模型设计学习的网站么?
- mysql 下的.err 文件太大 怎么处理?
- select distinct的sql语句如何优化
- 还是MySql的编码问题,可以插入中文,但符号插不进去……
- 一个有挺有意思的问题!
- Mysql并发控制加锁问题
- 请问如何用DELPHI通过ODBC连接LINUX下的MYSQL数据库?急!
- mysql百万级查询怎么样才能快速查询呢
- 批量查询B表(违禁品库)中的违禁品词库,返回A表,返回匹配的第一个词即可
- 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多点。、不知是怎么回事?