Skip to content Skip to sidebar Skip to footer

How To Do A Like Query In Sqlite (in Javascript) Whilst Passing In The Search Term As A Parameter

I am using React Native and am querying a SQLite database. I wish to perform a like query, specifying the search term as a parameter. The below works fine with the ? notation. SELE

Solution 1:

You can do string concatenation in SQLite:

SELECT*from People WHERE Name LIKE'%'|| ? ||'%'

Another option is to concatenate the percent marks with the parameter in your javascript code before passing it to the query, so you can then do:

SELECT*from People WHERE Name LIKE ?

Post a Comment for "How To Do A Like Query In Sqlite (in Javascript) Whilst Passing In The Search Term As A Parameter"