query to get number of childs from parent child table
Database
4
Posts
4
Posters
0
Views
1
Watching
-
hi i have a table that store my subject. each subjct has a parentid that refer to one subject id in itself table. how can i write query that return subject with number of there childs?
sepel
-
hi i have a table that store my subject. each subjct has a parentid that refer to one subject id in itself table. how can i write query that return subject with number of there childs?
sepel
-
hi i have a table that store my subject. each subjct has a parentid that refer to one subject id in itself table. how can i write query that return subject with number of there childs?
sepel
You might want to have a google and look at recursive common table expressions (CTE) (if you're on SQL2005).