parents_childs

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow em Português

Perguntas e respostas para programadores profissionais e entusiastas

declare @users table (id int, parent_id int, name varchar(50), email varchar(50))
insert @users values
 (1, null, 'Jane', '2id@test.com'),
 (2, null, 'Alf', 'iamalf@test.com'),
 (3, 1, 'John', 'yyyiqw@test.com'),
 (4, 1, 'Don', 'vxx2x@test.com'),   
 (5, null, 'Ken', 'thomson@test.com'),
 (6, null, 'Steve', 'ap@test.com'),
 (7, 4, 'Maria', 'zxmash@test.com'),
 (8, 4, 'Peter', 'kac@test.com'),
 (9, 4, 'Camila', 'mila@test.com'),
 (10, 7, 'Tom', 'ltomd@test.com');
       
 select * from users;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results