I have a table which a column is a string with three characters, each character has a value 0 or 1. I'd like to select those rows according to the case.
I'd like to perform a query like that:
SELECT * FROM Item WHERE group_type LIKE ?
? can be 100 or 101 or 011 or 111 or 001. A combination with 0 and 1 in three characters.
I'm trying to 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 is returning everything that starts with 1 as expected. case3 is returning everything that ends with 1 as expected. case2 is returning everything! It doesn't metter the value in the beggining, middle or end. It's returning everything.
case1 and case3 are working fine. However, case2 isn't working. Is there any problem with that?