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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 complicated count

Author  Topic 

sgebbie
Starting Member

7 Posts

Posted - 2002-06-20 : 18:15:23
I really need some help here.

I have a table [family]:parent_name, my_name

and I want to pass 'adam' as a parameter and count the number of family members at each generation down 3 generations

the data would be:
god, adam
adam, Michael
Michael, Lucifer
adam, john
John, Matthew
Matthew, David
David, Peter
Peter, Paul
Paul, Wendy

so 'Adam' has 5 members (3 levels deep, john&michael&Lucifer&Matthew&David)
Level1:2 members-John&Michael
Level2:2 members-Matthew&Lucifer
Level3:1 member-David

, David's offspring are ignored.


I cannot understand 'books online' so am pretty much completly stuck and the topics i have seen are similar but still different and confuse me more than anything.
If anyone can help I would really appreciate it
thanks in advance
Stephen

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-06-20 : 18:17:43
And we try to post topics once here so please see this one: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=17018

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -