Results 1 to 4 of 4

Thread: SQL Query

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Answers
    2

    Question SQL Query

    How to convert rows in column using SQL in Oracle;
    for example
    sl_no
    1
    2
    3
    4
    output is 1234;

    How to convert one column value into rows using SQL
    for example
    employee_name
    Kumar

    output
    K
    u
    m
    a
    r


  2. #2
    Expert Member
    Join Date
    Sep 2005
    Answers
    206

    Re: SQL Query

    Which database you are trying this query.. Here is an example ..

    if you are using Oracle .. have you tried using LISTAGG, over .. again depends on the version you are using

    [IMG]www.geekinterview.com/image/ora6.gif[/IMG]

    Attached Images Attached Images SQL Query-ora6-gif 

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Answers
    19

    Re: SQL Query

    Nice. Can you say how to get this output in SQL Server ??


  4. #4
    Expert Member
    Join Date
    Sep 2005
    Answers
    206

    Re: SQL Query

    in SQL Server, you can use COALESCE or case combination to get same output ..

    or if you are using sql server 2008 , use pivot

    Here is a good example for sql server Convert Rows to Columns


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