Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 inner join?

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2002-03-28 : 11:35:04
I have these 3 tables with the following structures:

Cycle
- lngCycleID
- txtCycleName
- lngBlockID
...

Objectives
- lngObjectiveID
- lngBlockID
...

TestCases
- lngCaseID
- lngObjectiveID
- txtName
...

How do I grab the testcases.txtname given a cycle.txtcyclename? is this best done using inner joins?


JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2002-03-28 : 11:42:26
How about...

select t.txtname
from testcases t inner join objectives o on t.lngObjectiveID = o.lngObjectiveID
join cycle c on o.IngBlockID = c.IngBlockID
where c.txtCycleName like 'foo'


hth,
Justin

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-28 : 11:51:33
Yep:

SELECT C.txtCycleName, T.txtName
FROM Cycle C INNER JOIN Objectives O ON (C.lngBlockID=O.lngBlockID)
INNER JOIN TestCases T ON (O.lngObjectiveID=T.lngObjectiveID)


The word "INNER" is optional. Books Online details the differences between inner and outer JOINs.

SNIPED! Texas style!

Edited by - robvolk on 03/28/2002 11:54:21
Go to Top of Page

JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2002-03-28 : 12:05:09
Thats right baby!

Justin

Go to Top of Page
   

- Advertisement -