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
 General SQL Server Forums
 New to SQL Server Programming
 query help

Author  Topic 

Fu
Starting Member

23 Posts

Posted - 2005-11-01 : 08:24:19
tables:
A(id_A)
AT(id_A,id_T)
C(id_C)
CT(id_C,id_T)
T(id_T)
------------------
the query should return all C columns give id_A
------------------
is it possible to make such a query?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-01 : 08:30:49
[code]
select C.*
from A
join AT on A.id_a on AT.id_A
join CT on AT.id_T = CT.id_T
join C on C.id_C = id_CT
where A.id_A = @ID_A
[/code]


Go with the flow & have fun! Else fight the flow
Go to Top of Page

Fu
Starting Member

23 Posts

Posted - 2005-11-01 : 08:44:42
thanx but did u mean with this join C on C.id_C = id_CT >> join c on c.id_c=ct.id_C
:)
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-01 : 08:55:01
yes. sorry sbout that...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-01 : 23:37:42
Look for Joins in BOL, for more info on Joins

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -