Advertisement

09.26.2007 at 07:54AM PDT, ID: 22853861 | Points: 500
[x]
Attachment Details

Construct a fulltext search query linking 2 tables in mysql that returns a random result based on the day

Asked by MasonWolf in PHP and Databases, MySQL Server, SQL Query Syntax

Tags: , , , ,

I have two tables linked with a common identifier called "ShowID", and I need to do fulltext searching. I wasn't able to figure out how to construct my select query just by visiting dev.mysql.com, but I'm sure it's got to be doable.

The first table is called Guests, and I need to do a fulltext search of the fields "Expertise", "KnownAs", and "Bio". The second table is called Shows, and I need to do a fulltext search of the fields "Title", "Quote", "Intro", "Summary1", "Summary2", "Hook", and "TipList".

I want to return one result, picked randomly, based on a seed value that will change once per day. I also need to calculate the number of rows that would have been returned if the Limit were not used. The columns to be returned are "RadioShowID",  "PersonID", and "TextReference" in Guests, and then from Shows I need "Hook", "Segment1", "Title",  and "Redirect".

I hope that's all the information someone will need. I'm using php, so I thought perhaps I could use "ORDER BY RAND('.strtotime(date('Y-m-d')).')" to randomize the result based on the day the search is run, but I wasn't sure if FULLTEXT, with it's own ordering built-in, would even be compatible with using the ORDER BY modifier at the end of the query.

I am using MySQL version 4.1.22.Start Free Trial
[+][-]09.26.2007 at 11:58AM PDT, ID: 19965738

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2007 at 12:04PM PDT, ID: 19965779

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.26.2007 at 12:11PM PDT, ID: 19965847

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2007 at 12:56PM PDT, ID: 19966214

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.29.2007 at 10:55PM PDT, ID: 19986332

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628