php - 需要计算查询mysql的平均经过时间
问题描述
我需要计算一列数据类型 time(1) 的平均时间。但是,当我运行以下查询时,平均值不正确。考虑到它使用的值,它有点低。任何人都可以帮忙吗?
$statement2 = $dbhandle->prepare(
"SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(`actualsplit`))) as average
FROM workoutmasterv6
where teamid = ?
and workoutidv2 = ?
and actualsplit <> '00:00:00.0'
group by date
order by date asc");
这是我得到的
An Athlete 2018-04-29 00:02:01.9 2018-04-30 00:01:59.1
Another Rower 2018-04-29 00:02:00.4 2018-04-30 00:01:56.2
Average 00:02:00.5000 00:01:57.5000
29 号的时间应该平均,30 号的时间应该平均。正如你所看到的,它们有点偏离。
解决方案
推荐阅读
- mysql - 如果字段不为空,MYSQL 连接三个表
- swift - 无法转换“数据”类型的值?到预期的参数类型'UIImage
- r - 如何使用 doPostBack 在 R 中抓取动态表?
- python - ImportError:无法导入名称“_validate_lengths”
- selenium - 如何杀死保持 Web 浏览器打开的 WebDriver 实例
- logstash-grok - AWS Glue 自定义 grok 分类器不起作用
- identityserver4 - 实现IProfileService时支持“双账号”登录
- eclipse - 在 Eclipse 中使用 Maven 的 OpenJFX 11
- c++ - boost asio stable_timer上的多个递归async_wait
- python - 无法从 dart 语言调用 python 代码