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 |
usman400
Starting Member
1 Post |
Posted - 2011-11-03 : 05:05:23
|
HiI need help with recursive queries or any solution to my situation.I want to show family tree in rows and columnsI have following data in my table, (F = Father ID)(M= Mother ID)IdNo F M0 4 514 16 17 15 16 17 16 0 117 2 3I want to know how I can get the query (perhaps Union query and/or CTE etc)To show the results as follows:IdNo F M FF FM MF MM FFF FFM0 4 5 14 16 17 0 1 2 3 4 515 16 17 0 1 2 3 4 516 0 1 4 5 17 2 3 The base of the result is the hierarchy which can be understood by following image: <img src='http://img97.imageshack.us/img97/8193/unledjd.jpg'/>Usman Waheed |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|