DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Rows to Columns

  1. #1
    Join Date
    Jun 2006
    Posts
    11

    Rows to Columns

    hi all,

    I have the following sql

    SELECT
    TO_CHAR(a.APPT_dtime,'DD') APPT_DATE,
    COUNT(DISTINCT A.APPT_NO) "PER DAY"
    FROM MSS_appt_HDR A
    WHERE A.appt_DTIME BETWEEN TO_DATE('01-JAN-07 00:00:00', 'dd-mon-yy hh24:mi:ss')
    AND TO_DATE('31-JAN-07 23:59:59', 'dd-mon-yy hh24:mi:ss')
    AND A.STS != 'X'
    GROUP BY TO_CHAR(A.APPT_dtime,'DD');

    my result is like this

    APPT_DATE PER DAY
    03 18
    04 30
    05 30
    06 8
    08 34
    09 35
    10 32
    11 32
    12 33
    13 9
    15 33
    16 31
    17 29
    18 30
    19 32
    20 9
    22 27
    23 33
    24 34
    25 33
    26 34
    27 10
    29 31
    30 30
    31 32

    I want the appt_date to appear as column and below that the per day result.

    Can anyone help me in this regard?

  2. #2
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349
    did not get your question. Why do not you place the question in development section?
    http://www.perf-engg.com
    A performance engineering forum

Posting Permissions

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


Click Here to Expand Forum to Full Width