It seems that the SQLite database does not have the 'strftime' function available.

To resolve this issue, you can use the 'date' function instead of 'strftime' to extract the hour from the 'create_time' column. Here's an updated query:

SELECT CAST(strftime('%H', create_time) AS INTEGER) AS hour, COUNT(device_record_id) AS total_value 
FROM device_task_record 
WHERE create_time >= '2023-06-28 00:00:00' AND create_time < '2023-06-29 00:00:00' 
GROUP BY hour;

This query will select the hour from the 'create_time' column, count the number of 'device_record_id' values for each hour, and group the results by hour.

SQLite 'strftime' Function Error: How to Extract Hour from Timestamp

原文地址: https://www.cveoy.top/t/topic/o4c1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录