| 
	
 | 
 Posted by jonsjostedt on 09/13/05 18:11 
Hello all! 
What is a neat way to count the number of children for every parent in 
code 
below? 
 
CREATE TABLE parent 
( 
  row_id INTEGER 
    NOT NULL 
    IDENTITY(1,1) 
    PRIMARY KEY, 
 
    parent_name VARCHAR(100) 
) 
GO 
 
CREATE TABLE children 
( 
    parent_row_id INTEGER, 
    child_name VARCHAR(100) 
) 
 
INSERT INTO parent (parent_name) VALUES ('King') 
INSERT INTO parent (parent_name) VALUES ('Farmer') 
INSERT INTO children (child_name, parent_row_id) VALUES ('Prince', 1)
 
  
Navigation:
[Reply to this message] 
 |