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 2005 Forums
 Transact-SQL (2005)
 To Get List of the Childrens

Author  Topic 

thiyagu_rind
Starting Member

46 Posts

Posted - 2009-04-29 : 01:37:44
hi,


i have tables as parent and children

parenttable(TableName)

parentid parentname childid
1 p1 4
2 p2 4
3 p3 5




Childtable(TableName)

childid childname
4 x
4 y
4 z
4 a
5 b


I just want find out the Parent which is have more than children.
but here the 4 is the children for parentid 1 and 2. but i need to fetch only the parent id 1 because it is having more children.

Please help without using the group by and having class


Regards
Thiyagarajan

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-04-29 : 01:55:23
quote:
Please help without using the group by and having

Why ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

thiyagu_rind
Starting Member

46 Posts

Posted - 2009-04-29 : 02:00:48
ok, use group by also. bcoz my lead asked me to do without group by
Go to Top of Page

aprichard
Yak Posting Veteran

62 Posts

Posted - 2009-04-29 : 02:12:51
Hi,
According to table you posted,
ChildID 4 is for ParentID 1 and 2, so, Both ParentID 1 and 2 having more than one records, since ChildID 4 having multiple Records.

But you are saying that ParentID 1 only is having multiple child records.

I am getting confusion on that.




Go to Top of Page
   

- Advertisement -