user3233280
user3233280

Reputation: 291

Failed to get Columns Result From DB using 'like' in sqlite3 android?

Here is my query that i am running but its returning me nothing even data exists in column i am trying to pass keywords mention by user and searching data in DB and providing result to the user.

My query is:

SELECT fatwa.question_id, question.ques_img_name 
FROM fatwa, question  
WHEREfatwa.fatwa_keywords LIKE "hadees" AND fatwa.question_id =question.id 

While here is my Database: table image

Upvotes: 0

Views: 89

Answers (3)

Rohan Kandwal
Rohan Kandwal

Reputation: 9326

Change your query to the following:

SELECT fatwa.question_id, question.ques_img_name 
FROM fatwa, question  
WHERE fatwa.fatwa_keywords LIKE '%hadees%' AND fatwa.question_id =question.id 

you are not using like command properly.

Upvotes: 1

Amit Saxena
Amit Saxena

Reputation: 596

Use single quote with like statement:

SELECT fatwa.question_id, question.ques_img_name 
FROM fatwa, question  
WHERE fatwa.fatwa_keywords LIKE '%hadees%' AND fatwa.question_id =question.id

question_id should be an integer.

Upvotes: 1

M D
M D

Reputation: 47817

Execute your Query like:

SELECT fatwa.question_id, question.ques_img_name 
FROM fatwa, question  
WHERE fatwa.fatwa_keywords LIKE '%hadees%' AND fatwa.question_id =question.id 

More information go to: sqlite_like_clause

Upvotes: 2

Related Questions