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.
Author |
Topic |
amurark
Yak Posting Veteran
55 Posts |
Posted - 2012-12-08 : 00:30:50
|
pls help me suppose there are threee tables A,B and C.A has some records which are avalble in B table and B has some records which have in C table. But A and C dont have any connection. How tojoin A, B and C.For eg one record of A -->1000256 is in BB table have both--> 1000256, 1000930one record of C --> 1000930 is in Bhow to join three tables ?Pls help meAnkita |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2012-12-08 : 01:52:01
|
SELECT * FROM A JOIN B on A.id1 = b.id1JOIN C ON B.id2 = C.id2-Chad |
 |
|
amurark
Yak Posting Veteran
55 Posts |
Posted - 2012-12-08 : 02:28:54
|
thanks for your reply but it didn't returned any rows.SELECT A.element_id,A.sample_timestamp,B.SYS_NAME,B.ALIAS, C.BITSIN,A.CPUUTILIZATION,A.MemoryUTilization FROM NHV_ST_B_104022 A JOIN NHV_ELEMENT_FOR_USER B on A.element_id= b.element_idJOIN NHV_ST_B_104050 C ON B.element_id = C.element_idAnkita |
 |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-12-08 : 08:30:25
|
In the example you posted, what is the output that you are expecting? You can change the joins to FULL JOIN and see if that meets your requirements:SELECT * FROM A FULL JOIN B on A.id1 = b.id1FULL JOIN C ON B.id1 = C.id1 If that is not it, please post sample input data long with the required output. |
 |
|
|
|
|