I have two tables like T1
Boss employee
Bran josh
Bran paul
Bran i-sara
Bran shaun
Joseph will
Joseph i-alex
Joseph i-vicky
Joseph mary
Joseph cristi
T2
Worker object price
josh bus 2
paul car 5
i-sara i-sara null
Shaun skate 3
will football 2
i-alex i-alex null
mary dino 6
i-vicky i-vicky null
Cristi bike 5
I need to join both tables and get the output table like mentioned below
So I have written a query like below
select boss, employee, object, price from T1 left join on T1.employee=T2.worker order by boss;
By executing the above query I'm getting below output
Output:
Boss employee object price
Bran josh bus 2
Bran paul car 5
Bran i-sara i-sara null
Bran shaun skate 3
Joseph will football 2
Joseph i-alex i-alex null
Joseph mary dino 6
Joseph i-vicky i-vicky null
Joseph cristi bike 5
I want to remove the rows which has employee or object as "i-%" from the above output table which i have got after executing the query and place them in separate column with their respectice "boss" group. And get the output table as below
Boss employee object price person
Bran josh bus 2 i-sara
Bran paul car 5 null
Bran shaun skate 3 null
Joseph will football 2 i-alex, i-vicky
Joseph mary dino 6 null
Joseph cristi bike 5 null
OR
Boss employee object price person
Bran josh bus 2 i-sara
Bran paul car 5 null
Bran shaun skate 3 null
Joseph will football 2 i-alex
Joseph mary dino 6 i-vicky
Joseph cristi bike 5 null
Can anyone help me on achieving the output which i desire?