MySQL Forums
Forum List  »  Full-Text Search

Search Multiple Columns and Tables
Posted by: Sean Templeton
Date: December 11, 2008 01:52PM

I've searched the internet numerous different ways, and I can not find the answer to my question. I am creating an online library catalog for a non-profit homeschool library. My problem arises when I attempt to search for a book. For example, I want to search for all "Grade 5 History" books. Knowing already that there are Grade 5 "World" history books in the database too, still the only results I get are "Grade 5 History", it doesn't include the Grade 5 "World" History books. My next problem shows itself when I attempt to search multiple fields such as a publisher and subject. (Like Abeka math). Below is the query I'm currently using, and hope to change it to work the way I need. Any help is appreciated. I will answer any questions and/or provide any other data anyone needs to assist me. Thanks!


SELECT item.itemid, item.accessionnum, item.author, item.title, item.publisher, item.series, itemsubject.itemid, itemsubject.subject
FROM item INNER JOIN itemsubject on item.itemid=itemsubject.itemid
WHERE item.accessionnum LIKE '%txtSearchField%' OR item.author LIKE '%txtSearchField%' OR item.title LIKE '%txtSearchField%' OR item.publisher LIKE '%txtSearchField%' OR item.series LIKE '%txtSearchField%' OR itemsubject.subject LIKE '%txtSearchField%'

Options: ReplyQuote


Subject
Views
Written By
Posted
Search Multiple Columns and Tables
14741
December 11, 2008 01:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.