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.

Query Statement

I want to search for a keyword in all the columns of my database. So please help me for a query to execute like:

Code:

statement.executeQuery("select * from BOOKS where Title like '%"+Criteria+"%'");

Instead of only title i want to search in all the fields.

If the above is not possible then what is wrong the the following:

Code:

statement.executeQuery("select * from BOOKS where Title like '%"+Criteria+"%' Or Author like '%"+Criteria+"%' Or Publisher like '%"+Criteria+"%' Or Type like '%"+Criteria+"%' Or Genre like '%"+Criteria+"%' Or Keywords like '%"+Criteria+"%' Or Comment like '%"+Criteria+"%' Or Category like '%"+Criteria+"%' Or BookSubject like '%"+Criteria+"%' Or Series like '%"+Criteria+"%' Or Illustrator like '%"+Criteria+"%' Or Language like '%"+Criteria+"%' Or Location like '%"+Criteria+"%'");