1

I am working on a database with sqlite in an android app I want to get some data using a like clause

cursor = db.rawQuery("select * from INTERESTS contactid LIKE '%=?%'", new String[]{id + ""});
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ankit Chhabra
  • 73
  • 2
  • 10

1 Answers1

3

Assuming you really want to use the LIKE operator: ? variables don't go in quoted literals. You can use || to concatenate variables and literals:

contactid LIKE `%` || ? || '%'

(Left out the = in the LIKE pattern as it seemed out of place.)

Assuming you actually want an exact match and not LIKE:

contactid = ?
laalto
  • 150,114
  • 66
  • 286
  • 303