If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

if I do select * from books where text LIKE '%apples%' AND text LIKE '%oranges%';

I get 9 rows

however if I do
SELECT booknames.book, books.chapter, books.verse, books.text FROM books INNER JOIN booknames ON books.book = booknames.book from books where text LIKE '%apples%' AND text LIKE '%oranges%';

I get Empty set.

What am I missing. What I am ultimately trying to do is allow my users to enter boolean style keyword searches .

btw if I remove
AND text LIKE '%oranges%';
or change it to
OR text LIKE '%oranges%';
Then my query works.

Re: I am not understanding whats going wrong in my query

Originally posted by qa-guy
however if I do
SELECT booknames.book, books.chapter, books.verse, books.text FROM books INNER JOIN booknames ON books.book = booknames.book from books where text LIKE '%apples%' AND text LIKE '%oranges%';

I get Empty set.

I you did write your code exactly like this, you will need to remove the from-statement after your on-statement.