Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to get enames with comma seperated values by deptwise
on emp table?

Answer Posted / kavitha nedigunta

SELECT deptno ,
LTRIM(MAX( SYS_CONNECT_BY_PATH (
ename, ',')),',') EMP_STRING
FROM
(SELECT empno , ename, deptno,
row_number() OVER ( PARTITION BY deptno ORDER
BY rownum) rn
FROM EMP )
CONNECT BY deptno = PRIOR deptno
AND rn = PRIOR rn+1
START WITH rn =1
GROUP BY deptno
ORDER BY deptno;

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How long will it take to learn pl sql?

888


How many types of tables are there?

896


How to change the order of columns in Oracle SQL Plus ?

992


What version is sql?

961


Is it possible to sort a column using a column alias?

990


What is the difference between left join and right join?

887


Can we change the table name in sql?

887


How to use sql statements in pl/sql?

1050


How do I remove duplicates in two columns?

972


How do you create a unique index?

985


Write an sql query to select all records from the table?

967


What are local and global Indexes and where they are useful.

1377


What program will open a mdb file?

909


which tcp/ip port does sql server run on? : Sql dba

961


Why is the cursor important?

972