我在数据库中有一些项目。 我使用“like”关键字过滤
查询: mCursor = mDb.query(listTable, new String[] { ID_rs, Item_name, item_code, Unit_code, Tot_Amt, dis_count, }, Item_name + " like '%" + mix + "%' ORDER BY " + Item_name + " ASC", null, null, null, null, null);
例:数据库中的值1.SAKTHI readymix 2.curry Mix 3.Mixture
我的结果:1.SAKTHI readymix 2.curry Mix 3.Mixture
但我需要“咖喱混合,混合物”作为我的输出我怎么能得到它。 帮帮我!
I am having some items in database. i filter using "like" keyword
Query:mCursor = mDb.query(listTable, new String[] { ID_rs, Item_name, item_code, Unit_code, Tot_Amt, dis_count, }, Item_name + " like '%" + mix + "%' ORDER BY " + Item_name + " ASC", null, null, null, null, null);
Ex: values in the database 1.SAKTHI readymix 2.curry Mix 3.Mixture
my result : 1.SAKTHI readymix 2.curry Mix 3.Mixture
But i need "curry Mix, Mixture" as my output how can i get that. help me out!
最满意答案
继续你的意见,
您可以尝试使用语法
Item_name + " like '" + mix + "%' OR " + Item_name + " like '% " + mix + "%'"基本上,
第一个匹配以Item_name开头的, OR附加具有Space后跟Item_name的那些。 阿卡是一个新词。 (注意%之后的空格)Going on your comments,
You could try using the syntax
Item_name + " like '" + mix + "%' OR " + Item_name + " like '% " + mix + "%'"Where basically,
the first matches ones that start with Item_name, the OR attaches ones that have Space followed by Item_name. Aka are a new word. (note the space after the %)更多推荐
发布评论