Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Getting information from other table....
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

aviation_mike
Starting Member

USA
22 Posts

Posted - 27 March 2001 :  17:56:12  Show Profile  Visit aviation_mike's Homepage
I'm not sure how to explain this, and its probably really simple. Anways:

I want to search my forums I made. Now, I take the keyword and I look for like matches in the fields named "PostText". Here is the sql statement:

"SELECT * FROM Topic WHERE PostText LIKE '%" & keyword & "%' AND ForumID='" & ForumID & "' AND Active='1' ORDER BY '" & Order & "'"

The only thing is, my PostText is in a different table. It is in the "Posts" table!

Can I just do something like this...

"SELECT * FROM Topic WHERE Posts.PostText LIKE '%" & keyword & "%' AND ForumID='" & ForumID & "' AND Active='1' ORDER BY '" & Order & "'"

Any help is appriciated, and I know it's confusing!

big9erfan
Average Member

540 Posts

Posted - 27 March 2001 :  19:15:17  Show Profile
After the word from is the Table that you are seaching. That's where you want to have the name Posts.



http://www.ugfl.net/forums

Edited by - big9erfan on 27 March 2001 19:15:41
Go to Top of Page

aviation_mike
Starting Member

USA
22 Posts

Posted - 28 March 2001 :  15:58:04  Show Profile  Visit aviation_mike's Homepage
But I also need information out of the Topic table. I don't want to iterate each time a result is found just to display something.

www.FlightCommunity.com
The Aviation Enthusiast's Site!
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 28 March 2001 :  16:03:15  Show Profile  Visit HuwR's Homepage
You will need to join your tables in the query by a unique field. this is very rought since I do not know the relation ship between your tables, but you need to do something like this

SELECT TOPIC.*,OTHERTABLE.PostText FROM TOPIC,OTHERTABLE
WHERE OTHERTABLE.TOPIC_ID = TOPIC.TOPIC_ID AND
OTHERTABLE.PostText LIKE '%whatever%'

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07