Reputation: 1619
I here want to know the how should I write the where
clause in sqlite
query in android as most of the examples I have seen say address = ?
but I want to check substring
. Is there a way to check substring of the string present in the database columns.Maybe this is very simple but I didnot find any example of doing this yet.
Upvotes: 1
Views: 4309
Reputation: 10349
Use a string like below in place of WHERE clause
-> If the sub string is at begining of column value
columnName+" LIKE '"+subString+"%'"
-> If the sub string is at end of column value
columnName+" LIKE '%"+subString+"'"
-> If the sub string is at middle of column value
columnName+" LIKE '%"+subString+"%'"
Upvotes: 5