[英]How can I use GROUPBY date with Android Room Database?
I'm trying to create a Room Database with Date, using this tutorial: https://developer.android.com/training/data-storage/room/referencing-data .我正在尝试使用本教程创建一个带日期的房间数据库: https://developer.android.com/training/data-storage/room/referencing-data 。
I enter the Date in this format: Fri Aug 21 16:05:30 GTM 2020
and I can insert several items with the same date, but with different times.我以这种格式输入日期:
Fri Aug 21 16:05:30 GTM 2020
我可以插入多个日期相同但时间不同的项目。 How can I use query that GROUPBY by the same date (the same day)?如何在同一日期(同一天)使用 GROUPBY 查询?
I try with SELECT * FROM table GROUPBY date
but doesn't work.我尝试使用
SELECT * FROM table GROUPBY date
但不起作用。
I solved using SELECT * FROM user_table GROUP BY date(user_date/1000, 'unixepoch')
我解决了使用
SELECT * FROM user_table GROUP BY date(user_date/1000, 'unixepoch')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.