我想从表中按日期获取数据

时间:2019-04-02 09:32:35

标签: sqlite android-sqlite

我想从表中按日期获取数据。

这是表结构;

 String TABLE_VISIT_DETAILS = "CREATE TABLE IF NOT EXISTS "+DBContract.TABLE_VISIT_DETAILS+"("
                +DBContract.VISIT_DETAILS_ID+" INTEGER PRIMARY KEY AUTOINCREMENT,"
                +DBContract.VISIT_DETAILS_VISITOR_USER_ID+" INTEGER,"
                +DBContract.VISIT_DETAILS_MEET_TO+" TEXT,"
                +DBContract.VISIT_DETAILS_VISIT_DATE+" TEXT,"
                +DBContract.VISIT_DETAILS_ENTRY_TIME +" TEXT,"
                +DBContract.VISIT_DETAILS_EXIT_DATE_TIME +" TEXT,"
                +DBContract.VISIT_DETAILS_PURPOSE +" TEXT,"
                +DBContract.VISIT_DETAILS_STATUS +" TEXT,"
                +DBContract.VISIT_DETAILS_ITEM_CARRIED +" TEXT"+
                ")";

1 个答案:

答案 0 :(得分:0)

使用此查询在2个日期(时间戳)之间获取数据。

@Query(“ SELECT * FROM TABLE_VISIT_DETAILS WHERE date between:date1 AND:date2”) 列出getDataBetweenInterval(long date1,long date2);