Advertisement

05.29.2008 at 08:52AM PDT, ID: 23441907
[x]
Attachment Details

joing three tables in sql??

Asked by dkim18 in SQL Query Syntax

Hi,

Can you help me with joing three tables please?

I am doing freetext in sql server database.
I just want to list everything with this search word in it.
Say I have these three tables.

project(projectid,projectname)
projectpeople(projectid,peopleid)
people(people,lastname,firstname)

I have thse two queries from each table but I am not sure how I should merge two result tables.

select projectid,projectname
from project inner join projectpeople on project.projectid = projectpeople
where freetext(projectname,@searchword)

select peopleid,lastname,firstname
from people inner join people.id = projectpeople.peopleid
where freetext(lastname,@searchword) or freetext(firstname,@searchword)

I just want to list these two results in one table.
projectid,projectname,lastname,firstname,peopleid


Do I even need to use the linking table(junction table) in this case?
Thanks much.Start Free Trial
[+][-]05.29.2008 at 08:58AM PDT, ID: 21670400

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.

 
[+][-]05.29.2008 at 09:30AM PDT, ID: 21670774

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.

 
[+][-]05.29.2008 at 09:33AM PDT, ID: 21670804

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.

 
[+][-]05.29.2008 at 10:07AM PDT, ID: 21671101

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.

 
[+][-]05.29.2008 at 10:18AM PDT, ID: 21671213

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Sign Up Now!
Solution Provided By: Thomasian
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628