I have a table in which a column is a row with three characters, each character has a value of 0 or 1. I would like to select these rows according to the case.
I would like to execute a query like this:
SELECT * FROM Item WHERE group_type LIKE ?
? can be 100 or 101 or 011 or 111 or 001. Combination with 0 and 1 in three characters.
I am trying to execute a query using LIKE
WhereCondition where = null; switch (condition) { case case1: where = ItemDao.Properties.GroupType.like("1%"); break; case case2: where = ItemDao.Properties.GroupType.like("%1%"); break; case case3: where = ItemDao.Properties.GroupType.like("%1"); break; } List<Item> items = itemDao.queryBuilder().where(where).list();
case1 returns everything that starts with 1, as expected. case3 returns everything that ends with 1, as expected. case2 returns everything! This does not affect the value at the beginning, middle or end. He returns everything.
case1 and case3 are working fine. However, case2 does not work. Are there any problems with this?
source share