Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vijayakumar_svk
Yak Posting Veteran
50 Posts |
Posted - 2007-06-07 : 12:59:37
|
| Can anyone convert the following query into SQL server 2005 SELECT deptno , LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS concatenatedFROM ( SELECT deptno , ename , ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr , ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev FROM emp )GROUP BY deptnoCONNECT BY prev = PRIOR curr AND deptno = PRIOR deptnoSTART WITH curr = 1;Thank in advanceVJ==============================Work smarter not harder take control of your life be a super achiever |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|