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? Quote Link to comment 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/ Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 5, 2011 Share Posted August 5, 2011 Yes, but not per row. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.