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,352
  • 21
  • 80
  • 110
Ankit Chhabra
  • 73
  • 1
  • 9

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
  • 144,748
  • 64
  • 275
  • 293