I want to return the rows in my database that have the attribute in one of the fields equal to the parameter to the method. My code is:
public Cursor fetchStatus(String status){
Cursor mCursor =
mDb.query(DATABASE_TABLE, new String[] {KEY_COMPANY, KEY_POSITION, KEY_NOTES, KEY_WAGE, KEY_STATUS},
KEY_STATUS+ "= "+status, null, null, null, null)
;
if(mCursor!=null) mCursor.moveToFirst();
return mCursor;
}
I want to return the KEY_COMPANY, KEY_POSITION, KEY_NOTES, KEY_WAGE and KEY_STATUS columns where the KEY_STATUS is equal to the parameter 'status'
mDb.rawQuery("sql statement", null);Your code seems to be correct.