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按日期分組 –