I am getting this error
android.database.sqlite.SQLiteException: near "SELECT": syntax error: , while compiling: SELECT _id, c_type, s_name, s_numb, user_name, password FROM accounts WHERE SELECT * FROM TableName LIMIT 1 OFFSET 1
Here is the code the code that creates the problem . My intent is to get the ROWID of ith record from the table and then use that ROWID to delete an entry from the table.
public void deleteEntry(long i) {
String[] columns = new String[]{KEY_ROWID, KEY_CTYPE, KEY_SNAME, KEY_SNUMB, KEY_USRN, KEY_PASS};
Cursor cursor = ourDatabase.query(DATABASE_TABLE,columns,"SELECT * FROM " +DATABASE_TABLE+" LIMIT 1 OFFSET "+i, null, null, null, null, null);
if (cursor != null && cursor.moveToFirst())
{
cursor.moveToFirst();
long rowIds = cursor.getLong(0);
ourDatabase.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowIds, null);
}
// ourDatabase.delete(DATABASE_TABLE, KEY_SNUMB + "=" + siteNum, null);
//return ourDatabase.insert(DATABASE_TABLE,null,cv);
}
int iin the parameters if `i =5' then I need 5th record.