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 |
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-12-18 : 01:59:30
|
| Hello Friends,I am having two tables,one is user table and other one is connections table.User tableId Name140 kotti145 john150 prasad170 sam190 rajconnections tableId MyPId MyCId1 145 1402 140 1453 170 1404 140 1705 140 1506 150 1407 145 1908 190 145when i execute this query,i will get the MyCIdsselect MyCId from connections where MyPId=140I will this result145170150What i need is then i need to send the (145,170,150) to connections table and i need to get the result of the MyCIdAll this should be in a single query.Finally the result should beMyCId Name190 Raj which excludes the MyCId 140.Please help me to get the correct query.If you need more explanation,i will explain.Thanks in Advance. |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2009-12-18 : 02:11:50
|
| hi KOtti, i think this query will work.....select connections.MyCId,user.name from userinner join connections on user.id= connections.MyPIdwhere connections.MyPId=190regards,Divya |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-12-18 : 02:21:57
|
quote: Originally posted by divyaram hi KOtti, i think this query will work.....select connections.MyCId,user.name from userinner join connections on user.id= connections.MyPIdwhere connections.MyPId=190regards,Divya
Hello Divya,Thanks for your reply.I don't need the query like this,I need the second degree connectionsI mean users of usersThanks in Advance . |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-12-18 : 02:22:46
|
| Clearly post your expected output!!Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2009-12-18 : 02:30:00
|
| what is expected output???? |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-12-18 : 02:43:52
|
| Expected output is MyCId Name190 Raj |
 |
|
|
|
|
|
|
|