Dear All,
Kindly provide your suggestions to get the below explained requirement in a select query.
Scripts:-
Create Table Comma_Sep
(Id Number,
Name Varchar2(20),
City Varchar2(20),
Country Varchar2(20));
REM INSERTING into COMMA_SEP
Set Define Off;
Insert Into Comma_Sep (Id,Name,City,Country) Values (101,'Aron','California','US');
Insert Into Comma_Sep (Id,Name,City,Country) Values (102,'Mark','California','US');
Insert Into Comma_Sep (Id,Name,City,Country) Values (103,'Dany','Florida','US');
Insert Into Comma_Sep (Id,Name,City,Country) Values (104,'John','Cambridge','UK');
Insert Into Comma_Sep (Id,Name,City,Country) Values (105,'John','Bristol','UK');
Insert Into Comma_Sep (Id,Name,City,Country) Values (106,'Jeff','Bhauri','Saudi');
select country,name from comma_sep
group by country,name
order by country;
COUNTRY NAME
-------------------- --------------------
Saudi Jeff
UK John
US Aron
US Dany
US Mark
Expected Query Result:-
COUNTRY NAME
-------------------- --------------------
Saudi Jeff
UK John
US Aron,Dany,Mark
I want to display the name values in a comma separated list for each country if it has more than one person.
Please do the needful
Regards,
Jame