hukadeeze Posted July 24, 2007 Share Posted July 24, 2007 I'm trying to run a full text search on two tables. One is a table populated with books, the other with cards. The term I'm using to search in the code below matches one record in the books table. When I run the first block of code, which queries just the books table, the correct record is returned. However, when I modify the query to include the cards table as well, mysql throws an error stating there are incorrent arguments for the MATCH clause (#1210 - Incorrect arguments to MATCH). Have I constructed this query incorrectly? This query works: SELECT Title, AuthorIllustrator, Form, MATCH(Title, AuthorIllustrator, ISBN10, ISBN13) AGAINST ('Amadito') AS score FROM books WHERE MATCH(Title, AuthorIllustrator, ISBN10, ISBN13) AGAINST ('Amadito') This query does not work: SELECT books.Title, books.AuthorIllustrator, books.Form, cards.Title, cards.Artist, cards.CardNumber, MATCH(books.Title, books.AuthorIllustrator, books.ISBN10, books.ISBN13, cards.Title, cards.Artist, cards.CardNumber) AGAINST ('Amadito') AS score FROM books,cards WHERE MATCH(books.Title, books.AuthorIllustrator, books.ISBN10, books.ISBN13, cards.Title, cards.Artist, cards.CardNumber) AGAINST ('Amadito') Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/ Share on other sites More sharing options...
DeadEvil Posted July 24, 2007 Share Posted July 24, 2007 try to use LEFT JOIN SELECT books.Title, books.AuthorIllustrator, books.Form, cards.Title, cards.Artist, cards.CardNumber, MATCH(books.Title, books.AuthorIllustrator, books.ISBN10, books.ISBN13, cards.Title, cards.Artist, cards.CardNumber) AGAINST ('Amadito') AS score FROM books LEFT JOIN cards ON book_id = cards_id WHERE MATCH(books.Title, books.AuthorIllustrator, books.ISBN10, books.ISBN13, cards.Title, cards.Artist, cards.CardNumber) AGAINST ('Amadito') Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-306110 Share on other sites More sharing options...
hukadeeze Posted July 24, 2007 Author Share Posted July 24, 2007 I tried that, and I still get the same error. Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-306418 Share on other sites More sharing options...
hukadeeze Posted July 24, 2007 Author Share Posted July 24, 2007 Is there another way to full-text search the same term against two tables? Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-306423 Share on other sites More sharing options...
Illusion Posted July 25, 2007 Share Posted July 25, 2007 what ever the columns u r passing for MATCH should be in SELECT statement too........(First u need to retrive the values then match them against the word u r searcing for as u r not retriving the all the columns so u r getting the error, I guess) Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-307003 Share on other sites More sharing options...
hukadeeze Posted July 25, 2007 Author Share Posted July 25, 2007 sorry, that was an error in the posting. even when the select and match statements are equal mysql returns the same error. I did some research and found a post where someone said you can't full-text search more than one table. Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-307262 Share on other sites More sharing options...
fenway Posted July 30, 2007 Share Posted July 30, 2007 sorry, that was an error in the posting. even when the select and match statements are equal mysql returns the same error. I did some research and found a post where someone said you can't full-text search more than one table. That's true, an index can't span table. Link to comment https://forums.phpfreaks.com/topic/61476-whats-wrong-with-this-query/#findComment-311115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.