0
Q
SUM()
A
回答
0
这是否适合您?
WITH DATA as(
select 29 as VehicleId, '2017-01-02T 15:57:063000' as TripDateTime, '00:00:28' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 13:23:12' as TripDateTime, '00:00:21' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 17:23:05.063000' as TripDateTime, '00:07:11.9370000' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 14:59:44.063000' as TripDateTime, '00:08:19.9370000' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 15:45:44.063000' as TripDateTime, '00:01:22.9370000' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 15:17:58.063000' as TripDateTime, '00:03:29.9370000' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 18:52:15' as TripDateTime, '00:01:26' as TripDrivingDuration union all
select 29 as VehicleId, '2017-01-02T 17:05:24.063000' as TripDateTime, '00:13:09.9370000' as TripDrivingDuration
)
SELECT
VehicleId,
SUM(UNIX_SECONDS(PARSE_TIMESTAMP('%H:%M:%S', REGEXP_EXTRACT(TripDrivingDuration, r'(.*)\.\d+')))) elapsed_time
FROM data
GROUP BY VehicleId
+0
非常感谢你这会帮助我很多。这是答案 –
相关问题
- 1. select sum where sum
- 2. MySQL的SUM + SUM
- 3. sum sum amont in mysql
- 4. SUM
- 5. SQL SUM not SUM特定列
- 6. MSSQL select where sum sum than 0
- 7. MySQL SUM(column)+(SUBQUERY WITH SUM)
- 8. MySQL SUM减SUM和加入
- 9. 不能做SUM的SUM吗?
- 10. sum()+ sum()在C中有效,sum()返回void时吗?
- 11. MySQL - SUM和AS一样SUM(test1)AS test2,SUM(test2)
- 12. Hibernate:setParameter sum()
- 13. 用SUM
- 14. 用SUM()
- 15. sum arrays
- 16. 如何SUM结果两个SUM SQL?
- 17. Javascript,Sum Textfield不会显示SUM
- 18. PHP MySQL的选择SUM减去SUM
- 19. 与一个SUM中的SUM卡住
- 20. MySQL SUM查询
- 21. Sum DataTable列
- 22. SELECT SUM as field
- 23. MYSQL:JOIN make SUM double
- 24. Subset sum Prolog
- 25. GroupBy和Sum
- 26. DataTable sum duplicate rows
- 27. $ sum in MongoDB query
- 28. Odoo - one2many sum
- 29. linq groupby()和Sum()
- 30. select sum statement
你期待的结果是什么?对时间戳进行求和是没有意义的。 –
嗨艾略特, 该列意味着旅行的持续时间,所以我想要得到的总持续时间deviceId按日期分组 –