- 情感問答
- 答案列表
hql 模糊查詢:hql模糊查詢語句[朗讀]
這樣一個list,裡面存放的是多個employee對象.然後我想對這個list進行按照employee對象的名字進行模糊查詢.有什麼好的解決方案麼?比如我輸入的查詢條件為「wang」,那麼應該返回只包含employee1的list列表.listlist=newarraylist();employeeemployee1=newemployee();employee1.setname("wangqiang");employee1.setage(30);list.add(employee1);
updateusersetmale=(casenamewhen小姐then女when女士then女else男end)如果模糊匹配'小姐'比如有'張小姐'updateusersetmale=(casewhencharindex('小姐',name)>0then女whencharindex('女士,name)>0then女else男end)。
把字符串一個個取出來用or
stringhql="fromgoods.scwheresc.titlelike'%"+name+"%'";改下:stringhql="fromgoodsasscwheresc.titlelike'%'"+name+"'%'";
既然是模糊查詢機沒有必要給轉成日期型的數據了select*fromeducateastwheret.begintimelike%值%。