lundi 8 juin 2015

SQLite exception in LIKE query

I've got search query "aa bb" and also there is "aa bb cc" row in table. So my sql query should return that row. This is how I do:

select * from company
   where 
      (ASCII_NAME like %'aa'% 
      and ASCII_NAME like %'bb'%) 
   and CITY_ID=0 and parent=-1;

But my log says:

android.database.sqlite.SQLiteException: near "%": syntax error (code 1): , while compiling: select * from company where (ASCII_NAME like %'aa'% and ASCII_NAME like %'bb'%) and CITY_ID=0 and parent=-1

What is wrong?

Aucun commentaire:

Enregistrer un commentaire