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

Thread: Need help with sqlscript

  1. #1
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586

    Need help with sqlscript

    Hello: I have an output and have been asked to provide a total for the sessions column. how do I do that?

    Thanks for your help in advance.
    Code:
    SQL> select * from db_concurrent_session_prd where ddate like '28-DEC-2004%';
    
    DDATE                     NAME                                       SESSIONS HOSTNAME
    ------------------------- ---------------------------------------- ---------- ----------
    28-DEC-2004 03PM          Meritt_Review(Prod)                               1 TPA209
    28-DEC-2004 03PM          Prism(prd)                                        1 TPA209
    28-DEC-2004 03PM          Documentum(PIR)                                   1 ERROR:
    28-DEC-2004 03PM          Documentum(SOP)                                   9 TPA225
    28-DEC-2004 03PM          Documentum(PLC)                                   7 TPA252
    28-DEC-2004 03PM          Documentum(GDM)                                  16 TPA224
    28-DEC-2004 03PM          Documentum(LEG)                                   8 TPA252
    28-DEC-2004 03PM          Documentum(ITT)                                   8 TPA225
    28-DEC-2004 03PM          Documentum(NPP)                                   7 TPA252
    28-DEC-2004 03PM          Documentum(PCC)                                   1 ERROR:
    28-DEC-2004 03PM          Sample_Guardian(prod)                            10 takpsai
    28-DEC-2004 03PM          Informatica_Saiprd(prd)                           2 takpsai
    28-DEC-2004 03PM          Intelligent_center(PRD)                           6 TPA228
    28-DEC-2004 03PM          TimeSheet(Prod)                                   1 TPA272
    28-DEC-2004 03PM          CTMImpact(PROD)                                   1 ERROR:
    28-DEC-2004 03PM          HRWEB(Prod)                                       1 TPA209
    28-DEC-2004 03PM          ARIS-g(Prod)                                      8 TPA251
    28-DEC-2004 03PM          Retest(Prod)                                      1 ERROR:
    28-DEC-2004 03PM          BOP(Prod)                                         1 TPA228
    28-DEC-2004 03PM          DataClearing(Prod)                                4 takpdch1
    28-DEC-2004 03PM          GP(Prd)                                           1 ERROR:
    28-DEC-2004 03PM          Safety_Datanart(Prod)                             1 ERROR:
    28-DEC-2004 03PM          EvenActivity(Prod)                                1 ERROR:
    28-DEC-2004 03PM          TrackWise(Prod)                                   1 ERROR:
    28-DEC-2004 03PM          CARS-38(Prod)                                     1 ERROR:
    28-DEC-2004 03PM          MEDICAID(Prod)                                    1 ERROR:
    28-DEC-2004 03PM          SOP(Prd)                                          1 TPA228
    Last edited by marist89; 12-28-2004 at 05:53 PM.
    "High Salaries = Happiness = Project Success."

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092

  3. #3
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    Marist

    thanks for the heads up. So I have to
    COMPUTE SUM OF SESSIONS ON DDATE?
    "High Salaries = Happiness = Project Success."

  4. #4
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    I tried to follow this example but it didnt work..
    BREAK ON JOB_ID SKIP 1;
    COMPUTE SUM LABEL 'TOTAL' OF SALARY ON JOB_ID;
    SELECT JOB_ID, LAST_NAME, SALARY
    FROM EMP_DETAILS_VIEW
    WHERE JOB_ID IN ('AC_MGR', 'SA_MAN')
    ORDER BY JOB_ID, SALARY;


    this is what I am doing.
    COLUMN DUMMY NOPRINT
    compute sum of sessions on dummy
    BREAK ON DUMMY SKIP 1
    select ddate "Date", Name "Server Name", sessions, hostname from db_concurrent_session_prd where ddate like '28-DEC-2004%';

    but no total.

    ********** ----------
    TOTAL 61000
    "High Salaries = Happiness = Project Success."

  5. #5
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    PHP Code:
    jeffh@lx920> /
    jeffh@lx920select from xyz;

    X                    Y                             Z
    -------------------- -------------------- ----------
    12/28/2004 19              1                       1
    12
    /28/2004 19              2                       2
    12
    /28/2004 19              3                       0
    12
    /28/2004 19              4                       1
    12
    /28/2004 19              5                       2
    12
    /28/2004 19              6                       0
    12
    /28/2004 19              7                       1
    12
    /28/2004 19              8                       2
    12
    /28/2004 19              9                       0
    12
    /28/2004 19             10                       1
    12
    /28/2004 19             11                       2
    12
    /28/2004 19             12                       0
    12
    /28/2004 19             13                       1
    12
    /28/2004 19             14                       2
    12
    /28/2004 19             15                       0
    12
    /28/2004 19             16                       1
    12
    /28/2004 19             17                       2
    12
    /28/2004 19             18                       0
    12
    /28/2004 19             19                       1
    12
    /28/2004 19             20                       2

    20 rows selected
    .

    Elapsed00:00:00.00
    jeffh
    @lx920> break on report
    jeffh
    @lx920compute sum of z on report;
    jeffh@lx920select from xyz;

    X                    Y                             Z
    -------------------- -------------------- ----------
    12/28/2004 19              1                       1
    12
    /28/2004 19              2                       2
    12
    /28/2004 19              3                       0
    12
    /28/2004 19              4                       1
    12
    /28/2004 19              5                       2
    12
    /28/2004 19              6                       0
    12
    /28/2004 19              7                       1
    12
    /28/2004 19              8                       2
    12
    /28/2004 19              9                       0
    12
    /28/2004 19             10                       1
    12
    /28/2004 19             11                       2
    12
    /28/2004 19             12                       0
    12
    /28/2004 19             13                       1
    12
    /28/2004 19             14                       2
    12
    /28/2004 19             15                       0
    12
    /28/2004 19             16                       1
    12
    /28/2004 19             17                       2
    12
    /28/2004 19             18                       0
    12
    /28/2004 19             19                       1
    12
    /28/2004 19             20                       2
                                              
    ----------
    sum                                               21

    20 rows selected

    Jeff Hunter

  6. #6
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    Thanks Marist. That did it.
    "High Salaries = Happiness = Project Success."

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