Android : How to fetch rows with values starting '%' in android

on Thursday, September 18, 2014


I have a database in which I have few tables. I have a table which contains a column containing tag names and tag ids. There is a situation where I have tag name and I want the tag ids for all those tags whose tag names start with the input text.. The problem is that when I am hitting database for tag name "%" then it is returning all the rows of that table. But I need only those rows which contains tag names starting with the the input text (which in this case is starting with the "%" symbol). Example if the rows contain the following the tag names - abc, %test_tag, etc. then the result should be "%test_tag if I search for "%"


The query which I am using is



SELECT * FROM Tags WHERE TagName like '"+tagName+" %'


Please help.


0 comments:

Post a Comment