ActiveAndroid
ActiveAndroid copied to clipboard
Select query
Hi guys I need to know
Sqllite query for select the record older than 30 days, Statement : String sql = "SELECT * FROM myTable WHERE myDate <= date('now','-30 day')"; Cursor mycursor = db.rawQuery(sql);
And what would be the query in active android i just tried below snippet List<Object> dataModel = new Select().from(DatabaseModel.class).where("timestamp <= date('now','-30 day')").execute(); Result : its selects all records, Anyone help me about, if you got any solution
Hi if field myDate as java.util.Date or java.sql.Date or Calendar use "SELECT * FROM myTable WHERE date(myDate/1000, 'unixepoch') <= date('now','-30 day')"; else if field myDate as String you need to specify date format via date function