Danial Sports
Danial Sports

Reputation: 11

How to use sql statement Between and like together

I have an sqlite database in android app and I want to search in (zan) table between 1-100 range in (id) column then withing that range find words similar in (eng) column, but it does not return anything and it does not give error either, thanks.

 "Select * from zan where id (between 1 and 100) and eng like '"+smilarkeyword+"&'"

Upvotes: 0

Views: 1010

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

Should be id between and the wildchar for like is % (or _)

  "Select * from zan 
  where id between 1 and 100  
  and eng like '%"+smilarkeyword+"%'"

where % stands for 0 or more characters and _ stands for exactly one character

Upvotes: 2

Related Questions