Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

SQL Problem

veedubveedub Member Posts: 2
Hello,

I am fairly new to SQL and need to consult the experts on this one.

I have a table containing two columns that have a parent-child relationship. I have another column, called children, which is empty, but I'd like to run a query that would populate it with the number of child rows it has in the
table.

I'd like the table to look like this:

ID | ParentID | Children
--------------------------
1 | NULL | 2
2 | 1 | 0
3 | 1 | 1
4 | 3 | 0

Does anyone know a simple method of populating this children column?

Thanks
Renee


Sign In or Register to comment.