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

Thread: query help --very urgent

  1. #1
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    401

    query help --very urgent

    query 1
    -----------------
    select job_id,stage_id, to_char(created_date,'DD-MON-YYYY HH24:MI:SS')
    from job_history where stage_id in(5426,5428) and job_id=12345


    JOB_ID STAGE_ID TO_CHAR(CREATED_DATE
    ------ ---------- --------------------
    12345 5426 26-NOV-2001 15:15:14
    12345 5428 29-NOV-2001 16:56:23
    12345 5428 30-NOV-2001 08:50:23

    query 2
    ------------------
    select trunc(j.created_date),count(j.job_id),sum(j1.created_date -j.created_date)
    from job_history j, job_history j1,stages s
    where j.job_id=j1.job_id
    and j.stage_id=s.stage_id and
    s.system_stage_id between 3 and 4 and
    j.job_id=12345
    group by trunc(j.created_date) ;

    TRUNC(J.C COUNT(J.JOB_ID) SUM(J1.CREATED_DATE-J.CREATED_DATE)
    --------- --------------- -----------------------------------
    26-NOV-01 18 97.7167477


    my query 2 result is incorrect because it should calculate time difference b/n the below only.

    12345 5426 26-NOV-2001 15:15:14
    12345 5428 29-NOV-2001 16:56:23

    how do i restirct this if a job has multiple same stage id's


    Pls help

    Thanks in advance

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    and that's very urgent


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