Home » Other » Training & Certification » transpose a row
transpose a row [message #262905] Tue, 28 August 2007 08:33 Go to next message
dr46014
Messages: 49
Registered: February 2007
Member
hi all
i have selected one table where there is a column A containing 7 weekdays from sunday to saturday.how can i make it in to a single row
for e.g

weekdays
__________________________
sunday monday tuesday ...... saturday
Re: transpose a row [message #262913 is a reply to message #262905] Tue, 28 August 2007 08:41 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Search for the keyword PIVOT. this question has been asked and answered many many times.
Re: transpose a row [message #262924 is a reply to message #262905] Tue, 28 August 2007 09:01 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just for my fun: Embarassed
SQL> with 
  2    data as (
  3      select trim(to_char(trunc(sysdate, 'WW')+level-1,'Day')) d, 
  4             level n
  5      from dual
  6      connect by level <= 7
  7    )
  8  select sys_connect_by_path(d,' ') weekdays
  9  from data
 10  where n = 7
 11  connect by prior n = n-1
 12  start with n = 1
 13  /
WEEKDAYS
----------------------------------------------------------------
 Lundi Mardi Mercredi Jeudi Vendredi Samedi Dimanche

1 row selected.

Regards
Michel
Previous Topic: Procedure
Next Topic: Should I write the Oracle OCA?
Goto Forum:
  


Current Time: Thu Mar 28 13:02:23 CDT 2024