I am just trying to return a few results from each
category. like this:
http://cnet.search.com/search?timeout=3&q=php

sql query example:
SELECT id, article_date, category, region, title FROM
articles WHERE MATCH (title,article) AGAINST
('$search_word');

There are 20 possible categories that may return
so multiple selects could provide what I need - but
not much sense in running 20 queries for each search

Here is an example that would work by running multiple
queries.

SELECT id, article_date, category, region, title FROM
articles WHERE MATCH (title,article) AGAINST
('$search_word') AND category = 'news' LIMIT 0,5;
/* display up to 5 news category matches and link to
'more news results' */

SELECT id, article_date, category, region, title FROM
articles WHERE MATCH (title,article) AGAINST
('$search_word') AND category = 'features' LIMIT 0,5;
/* display up to 5 news category matches and link to
'more features results' */

SELECT id, article_date, category, region, title FROM
articles WHERE MATCH (title,article) AGAINST
('$search_word') AND category = 'coverstory' LIMIT
0,5;
/* display up to 5 coverstory category matches and
link to 'more coverstory results' */


--- Raphael Pirker <[EMAIL PROTECTED]>
wrote:
> top 5 based on what? if it's numbers or plain text
> you could use ORDER, if
> it's a search query you'd use LIMIT 0,5
> 
> Cheers,
> 
> Raphael
> 
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to