Hi
Query Sql server Only
CREATE TABLE ONE
(
EMPID INT,
EMPNAME VARCHAR(40),
)
CREATE TABLE ONE1
(
ID INT,
DEPTNAME VARCHAR(40),
REFID INT
)
--insert into ONE values(1,'AA1')
--insert into ONE values(2,'AA2')
--insert into ONE values(3,'AA3')
--insert into ONE values(4,'AA4')
select * from ONE
--insert into ONE1 values(1,'Dept1',1)
--insert into ONE1 values(1,'Dept1',2)
--insert into ONE1 values(2,'Dept2',3)
--insert into ONE1 values(2,'Dept2',4)
--insert into ONE1 values(3,'Dept3',5)
select * from ONE
select * from ONE1
-- I Need output this
1 Dept1 1,2
2 Dept2 2,3,4
3 Dept3 5
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com