slno from to
1 a e
2 a b
3 c d
4 c e
....... like this
These all a b c d e are logged in user need to show who they are related now i need a select statement to select the related.
firstly i used
Select*from names wherefrom=@zx (@zx is the session )
by this i can get the values for only a and c.
But i need to display related data of b,d and e too i need to use only one select command. is there any select command to select mutually related data. as each time someone of this logged in need to show who they are related.
i need to show like this when a logged in the page shows e and b , when c logged in then d and e , and when e logged in then it should show a and c .. plz help me wid this
coolborah
Member
5 Points
4 Posts
sql query to display all connected data from within a table
Dec 03, 2011 09:18 AM|LINK
I have a SQL table 'names' filled like this
These all a b c d e are logged in user need to show who they are related
now i need a select statement to select the related.
by this i can get the values for only a and c.
But i need to display related data of b,d and e too i need to use only one select command. is there any select command to select mutually related data. as each time someone of this logged in need to show who they are related.
i need to show like this when a logged in the page shows e and b , when c logged in then d and e , and when e logged in then it should show a and c .. plz help me wid this
sql asp.net
Gayomard Meh...
Participant
964 Points
241 Posts
Re: sql query to display all connected data from within a table
Dec 03, 2011 11:03 AM|LINK
you can try ascii conversion and between clause...
kaushik_tatv...
Contributor
2808 Points
500 Posts
Re: sql query to display all connected data from within a table
Dec 03, 2011 12:20 PM|LINK
use as following:
select * from table1 where ( frm = 'a' and tom <> 'a') or ( tom = 'a' and frm <> 'a')
select * from table1 where ( frm = 'e' and tom <> 'e') or ( tom = 'e' and frm <> 'e')
MARK AS ANWER IF THIS WORKS....
Cheers!
- Kaushik Patel