MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 24th, 2006, 06:21 AM
danielpearce danielpearce is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 10 danielpearce User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 5 sec
Reputation Power: 0
Question Selecting from multiple tables

Hi,

I have two tables "Post" & "Reply" which (oddly enough) contain the posts and replies for a forum, like so...

Post
------
id
title
content

Reply
------
id
postid
reply

I'm now trying to create a search facility that will not only look up the posts and match the search term against the content field, but look up both Post.content and Reply.reply and retieve the results in order of relevance with Post.title as the title.

The problem is when looking up the reply table I need to cross reference the Reply.postid field with the Post.id field.

I've been fumbling around with such statements as...

"SELECT Jude_forum_posts.title
FROM Jude_forum_posts
WHERE Jude_forum_posts.id =
(SELECT Jude_forum_replies.postid FROM Jude_forum_replies WHERE MATCH (Jude_forum_replies.reply) AGAINST ('$searchTerm'))"

...but not getting anywhere. I'd be really grateful if anyone could let me know where I'm going wrong?

Cheers,

Daniel

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Selecting from multiple tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway