Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Thumbs up Unanswered: multiple row result in single row

    How can I get a multiple row result in a single row.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: multiple row result in single row

    Originally posted by LoNe
    How can I get a multiple row result in a single row.
    That's a pretty terse question, but my guess is you mean this sort of thing?
    PHP Code:
    SQLselect job
      2  
    ,      sum(DECODE(deptno,'10'1)) as "10"
      
    3  ,      sum(DECODE(deptno,'20'1)) as "20"
      
    4  ,      sum(DECODE(deptno,'30'1)) as "30"
      
    5  from   emp
      6  group by job
      7  order by job
    ;

    JOB               10         20         30
    --------- ---------- ---------- ----------
    ANALYST                       2
    CLERK              1          2          1
    MANAGER            1          1          1
    PRESIDENT          1
    SALESMAN                                 4 

  3. #3
    Join Date
    Feb 2004
    Posts
    2

    Re: multiple row result in single row

    Sorry for my imperfect description.

    Normally one row for each value.
    I want to have all results in one row.

    SQL> 1 select job from emp;

    JOB
    -----------
    ANALYST
    CLERK
    MANAGER
    PRESIDENT
    SALESMAN


    The answer shall be shown like this.

    SQL> 1 select ???job from emp;

    JOB
    -----------
    ANALYST CLERK MANAGER PRESIDENT SALESMAN

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: multiple row result in single row


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •