Reputation: 3805
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?
Upvotes: 0
Views: 137
Reputation: 66
Include % sign in single quotes. Like:
select emp_name from employee where emp_name like '%s%';
Upvotes: 1
Reputation: 15336
Your syntax is wrong
select * from company
where
(ASCII_NAME like '%aa%'
and ASCII_NAME like '%bb%')
and CITY_ID=0 and parent=-1;
Upvotes: 1