XpertWorlock Posted August 3, 2011 Share Posted August 3, 2011 Okay, I have caches of pages and I need to be able to get a sql query to search more than one keyword, the table goes as following : KEYWORD URL ----------------------- martial home arts home martial about Example : if I search "martial arts", how would I get back results in order "home","about". As "home" has both words, where "about" has only 1 word? Any help guys? Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/ Share on other sites More sharing options...
fenway Posted August 3, 2011 Share Posted August 3, 2011 You have one keyword/url tuple for each keyword, and each page/ Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/#findComment-1251458 Share on other sites More sharing options...
XpertWorlock Posted August 4, 2011 Author Share Posted August 4, 2011 There could be hundreds of keywords per url. Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/#findComment-1251850 Share on other sites More sharing options...
fenway Posted August 5, 2011 Share Posted August 5, 2011 Yes, but not per row. Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/#findComment-1252269 Share on other sites More sharing options...
kickstart Posted August 5, 2011 Share Posted August 5, 2011 Hi Using the scheme you already have SELECT URL, COUNT(Keyword) AS KeywordCount FROM KeywordTable WHERE Keyword IN ('Martial', 'Arts') GROUP BY URL ORDER BY KeywordCount All the best Keith Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/#findComment-1252464 Share on other sites More sharing options...
fenway Posted August 5, 2011 Share Posted August 5, 2011 Unless you wanted only those results with ALL keywords, in which case you need to having a HAVING clause, or a CROSS JOIN. Link to comment https://forums.phpfreaks.com/topic/243719-need-a-search-to-work-with-more-than-1-word/#findComment-1252514 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.