Connecting Tech Pros Worldwide Help | Site Map
Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old October 30th, 2007, 06:51 PM
Newbie
 
Join Date: Oct 2007
Posts: 1
Default multiple cloumns in single row

Below query returns row with coma separated column values. I would need some help if it is on primary column and not on ROW_NUMBER() OVER().

http://www.thescripts.com/forum/thread432951.html

WITH source(rn,name) AS (SELECT ROW_NUMBER() OVER() AS rc,
name
from table ),
rec(n,name) AS (SELECT 2,CAST(name AS VARCHAR(2000))
FROM source WHERE rn = 1
UNION ALL
SELECT n+1, rtrim(rec.name) || ',' || rtrim(source.name)
FROM source, rec WHERE n = rn)
SELECT name FROM rec ORDER BY n DESC FETCH FIRST ROW ONLY;

Thanks
Reply


Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.