Results 1 to 2 of 2

Thread: Write a SQL to print the rows horizonatally

  1. #1
    Geek_Guest
    Guest

    Write a SQL to print the rows horizonatally

    Write a SQL to print the rows horizonatally table consist of single field.

    Question asked by visitor pooja


  2. #2
    Contributing Member
    Join Date
    Apr 2006
    Answers
    46

    Re: Write a SQL to print the rows horizonatally

    try this -------------->>

    with t as
    (
    (select 'a' col from dual)
    union all
    (select 'a' col from dual)
    union all
    (select 'a' col from dual)
    union all
    (select 'a' col from dual)
    union all
    (select 'a' col from dual)
    )
    select
    max(decode(rn,1,col))col1,
    max(decode(rn,2,col))col2,
    max(decode(rn,3,col))col3,
    max(decode(rn,4,col))col4,
    max(decode(rn,5,col))col5
    from
    (select col,row_number() over(order by col)rn from t)
    order by col


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact