vendredi 22 mai 2015

How to get manager,employee pair output?

I just require Required output as i posted below.This question asked in an interview.

Table Structure:

create table #test
(
id int,
emp char,
roles char
)

insert into #test values(1,'A','M')
insert into #test values(2,'B','E')
insert into #test values(3,'C','E')
insert into #test values(4,'D','M')
insert into #test values(5,'E','E')
insert into #test values(6,'F','E')
insert into #test values(7,'G','M')
insert into #test values(8,'H','E')
insert into #test values(9,'I','E')
insert into #test values(10,'J','E')

Required output:

emp emp
A   B
A   C
D   E
D   F
G   H
G   I
G   J

Aucun commentaire:

Enregistrer un commentaire