-2

My data is " 1 1/2 Pounds boneless, skinless chicken breasts"

I have this code to search a keyword inside a certain field.

String sQuery= "SELECT _id," + RECIPE_NAME + " FROM " + TBL_NAME +" WHERE ING_1 %" + "'Chicken'" +"%";Cursor c = db.rawQuery(sQuery,null);

I am just searching for a certain word in my data. I dont know how should it be done.

  • 1
    Possible duplicate of [SQL SELECT WHERE field contains words](http://stackoverflow.com/questions/14290857/sql-select-where-field-contains-words) – Iulian Mar 10 '16 at 17:44

1 Answers1

1

You missed the like keyword. Without that the wildcards are useless :)

String sQuery= "SELECT _id," + RECIPE_NAME + " FROM " + TBL_NAME +" WHERE ING_1 like %" + "'Chicken'" +"%";Cursor c = db.rawQuery(sQuery,null);
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175