I want to
- Insert a new row into my table if it does not exist
- If key already exits, then update the entries but only if the field timestamp date is newer then the stored filed. I tried this with sqlite but it gives me an error near where. Im also not sure if this is correct and how to do it properly.
code:
String sql = "INSERT OR REPLACE INTO "+TABLE_USER+" (...)" +
" VALUES ('"..."'" +
") WHERE " + timestamp +
" > (select " + COLUMN_TIMESTAMP +
" from " + TABLE_USER + " where " + COL_NUMBER + " = '" nr + "')"
Insert or replace does not allow a where clause. I guess you have to do it in two steps.