combining 2 query results
Posted: Tue Jan 30, 2007 3:59 am
Hi I have 2 queries:
what I want to do is combine these 2 queries and then sort the results by the score.
Any ideas as to the best way to achieve this?
Thanks in advance
Code: Select all
$result = mysql_query("SELECT DATE_FORMAT(news_date, '%d-%m-%Y') as news_date2, news_id, news_headline, news_summary, news_body, news_image, news_image_detail, news_author, news_tj, news_pdf, news_pdf, news_tj_issue, news_price, news_rating, news_votes, news_tags ,
MATCH(news_headline, news_body) AGAINST('$k') AS score
FROM news
WHERE MATCH(news_headline, news_body) AGAINST('$k') ORDER BY score DESC");
and
$result2 = mysql_query("Select DATE_FORMAT(thread_date, '%d-%m-%Y') as thread_date2, thread_id, thread_title, thread_body,
MATCH(thread_title, thread_body) AGAINST('$k') AS score
FROM HRD
WHERE MATCH(thread_title, thread_body) AGAINST('$k') ORDER BY score DESC");Any ideas as to the best way to achieve this?
Thanks in advance