Need sql query for all employees list which are having lessthan maximum salary of manager in same departmnet;

HI
I want a sql query i.e., all employees list which are having lessthan maximum salary of manager in same departmnet;
my table is like this
employees
EMPLOYEE_ID                               NOT NULL NUMBER(6)
FIRST_NAME                                                   VARCHAR2(20)
LAST_NAME                                 NOT NULL    VARCHAR2(25)
EMAIL                                     NOT NULL          VARCHAR2(25)
PHONE_NUMBER                                              VARCHAR2(20)
HIRE_DATE                                 NOT NULL        DATE
JOB_ID                                    NOT NULL           VARCHAR2(10)
SALARY                                                           NUMBER(8,2)
COMMISSION_PCT                                          NUMBER(2,2)
MANAGER_ID                                                  NUMBER(6)
DEPARTMENT_ID                                             NUMBER(4)
if need the department table
departments:
DEPARTMENT_ID                        
NOT NULL NUMBER(4)
DEPARTMENT_NAME                      
NOT NULL VARCHAR2(30)
MANAGER_ID                                    
NUMBER(6)
LOCATION_ID                                   
NUMBER(4)

Try this:
select
   employees.last_name || ', ' || employees.first_name “Employee”,
   employees.salary “Emp Salary”,
   sub.salary “Mgr Salary”,
   employees.department_id  “Department” 
from
   employees,
   (  select
      mgr.department_id dept,
      max(mgr.salary) salary     
   from
      employees,
      employees mgr      
   where
      employees.mgr = mgr.employee_id      
   group by
      mgr.department_id) sub   
where
   employees.department_id = sub.dept      
   and employees.salary < sub.salary
Jeff

Similar Messages

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • SQL Query for all Function Name attached to Responsibility

    I have a requiremnet where in the data needs to be fetched giving all details of User Name, Responsibility Name, Function_user_name at responsibility level.
    For e.g when a user logs in ORacle application and gets in to a responsibility and uses short cut key (Cntrl + L), the application lists out all the form functions, i need those form funtion for all users at responsibility level.
    follwoing is the SQL i developed but its not listing the form function when we use (cntrl + L).
    SELECT fur.user_name, fur.description, fur.responsibility_name,
    mnu.user_function_name, mnu.function_name --, mnu.TYPE, mnu.PARAMETERS
    FROM (
    SELECT /*+ ordered use_nl(ffft) */
    DISTINCT fm.menu_id, ffft.user_function_name, fff.function_name,
    fff.TYPE, fff.PARAMETERS
    FROM (select distinct menu_id
    from apps.fnd_responsibility_tl frt,
    applsys.fnd_responsibility fr
    where 1=1
    and frt.responsibility_id = fr.responsibility_id
    and frt.application_id = fr.application_id
    and frt.responsibility_name = 'SLCHR Admin Asst' ) frm,
    apps.fnd_menus fm,
    apps.fnd_form_functions fff,
    apps.fnd_form_functions_tl ffft
    WHERE 1 = 1
    --AND fm.menu_id IN (1004979, 1009084)
    AND frm.menu_id = fm.menu_id
    AND fff.function_id = ffft.function_id
    AND fm.menu_id IN (SELECT me.menu_id
    FROM apps.fnd_menu_entries me
    START WITH me.function_id = fff.function_id
    CONNECT BY PRIOR me.menu_id = me.sub_menu_id)
    ) mnu,
    (SELECT fusr.user_name, fusr.description, frv.responsibility_name, frv.menu_id
    FROM apps.fnd_responsibility_vl frv,
    apps.fnd_user_resp_groups_direct frg,
    apps.fnd_user fusr
    WHERE 1 = 1
    --and   fusr.user_name = 'JLEWIS03'
    AND frv.responsibility_name = 'SLCHR Admin Asst'
    AND frv.end_date IS NULL
    AND fusr.user_id = frg.user_id
    AND fusr.end_date IS NULL
    AND frv.responsibility_id = frg.responsibility_id
    ) fur
    WHERE 1 = 1
    AND fur.menu_id = mnu.menu_id
    Please help

    Please see these docs.
    Checking Functions Associated with a User Menu or a Responsibility [ID 948512.1]
    HOW TO GENERATE MENU TREE FOR A MENU ATTACHED TO A RESPONSIBILITY IN ORACLE APPLICATIONS 11i ? [ID 312014.1]
    Thanks,
    Hussein

  • Need SQL query for PO that do NOT have 3-way match.

    The question is -- have any PO"s been generated with other then 3-way match selected - which means they overrode the set-ups in purchasing , to see if there are an PO that do NOT have 3-way match.
    Thanks
    Mohan.

    1)Generally when ever we will do Supplier setup we will select in the Receiving tab Match approval level we will select either 3-way ,2-way,4-way or we will keep that as blank.
    for that we do not have any direct column in the back end ,so we will use the following conditions.
    '2WAY' inspection_required_flag = 'N'
    receipt_required_flag = 'N'
    '3WAY' inspection_required_flag = 'N'
    receipt_required_flag = 'Y'
    '4WAY' inspection_required_flag = 'Y'
    receipt_required_flag = 'Y'
    2)When ever we will create a PO in the shipments level what ever the Match approval level,
    we defined in the supplier will automatically reflects in the shipments-More tab.
    3)Here i wants to know all the PO's whihc are having Match approval level differences between supplier definiton and PO's match approval level.
    (i.e If i will select a supplier for a PO , automatically we will get one Match approvallevel from supplier setup .if i will change that match approval level manually in the PO shipments -More tab i wants to know all that PO by using a SQL query.
    4)But for some PO's i am getting receipt_required_flag and inspection_required_flag as null.But in the Supplier setup it may be one of the Matching approval.
    Thanks
    Mohan.

  • Need sql query for typical scenario

    Hello Champs,
    I have a scenario where I am suppose to fetch data from a schema which is developed by other team ... (there are no primary keys even)
    the table structure is -
    Column A Column B Column C Column D
    1 h 6 u
    1 h 7 u
    1 h 8 u
    2 g 9 i
    2 g 0 i
    2 g 7 i
    3 t 3 h
    3 t 4 h
    3 t 5 i
    and my output should be exactly like :
    1 h 6,7,8 u
    2 g 9,0,7 i
    3 t 3,4 h
    so basically I want comma separated values for column c where remaining column values are same ...
    is it possible to achieve this result via SQL?? if not then what is the other solution??
    Please help .. I am working in IST and need solution urgently for this .. please help .
    TIA,
    Regards,
    Chintan

    if you have 11g
    WITH t AS (SELECT 1 cola,
                      'h' colb,
                      6 colc,
                      'u' cold
                 FROM DUAL
               UNION
               SELECT 1,
                      'h',
                      7,
                      'u'
                 FROM DUAL
               UNION
               SELECT 1,
                      'h',
                      8,
                      'u'
                 FROM DUAL
               UNION
               SELECT 2,
                      'g',
                      9,
                      'i'
                 FROM DUAL
               UNION
               SELECT 2,
                      'g',
                      0,
                      'i'
                 FROM DUAL
               UNION
               SELECT 2,
                      'g',
                      7,
                      'i'
                 FROM DUAL
               UNION
               SELECT 3,
                      't',
                      3,
                      'h'
                 FROM DUAL
               UNION
               SELECT 3,
                      't',
                      4,
                      'h'
                 FROM DUAL
               UNION
               SELECT 3,
                      't',
                      5,
                      'i'
                 FROM DUAL)
      SELECT cola, colb,  listagg (colc, ',') WITHIN GROUP (ORDER BY colc) colc, cold
        FROM t
    GROUP BY cola, colb, cold
    COLA     COLB     COLC     COLD
    1     h     6,7,8     u
    2     g     0,7,9     i
    3     t     3,4     h
    3     t     5     i

  • Need sql query for like operation.

    Hi All,
    i have table like name column and contain the data like
    ibm 100
    ibm 200
    ibm 300
    a2b
    a
    b
    c
    like this ....
    but sql query need search using like or any regular expression---
    select * from table where name like (ibm 200 and ibm 300).
    and i don't want use like this select * from table where name like' ibm 200' or name like 'ibm 300').
    can you please any body help to correct the above query...
    Edited by: anbarasan on Oct 16, 2011 10:02 PM

    WITH t AS
         (SELECT 'ibm 100' NAME
            FROM DUAL
          UNION ALL
          SELECT 'ibm 200' NAME
            FROM DUAL
          UNION ALL
          SELECT 'ibm 300' NAME
            FROM DUAL
          UNION ALL
          SELECT 'a2b' NAME
            FROM DUAL)
    SELECT *from t where    REGEXP_LIKE (name, 'ibm')
    and REGEXP_LIKE (name, '100|200')

  • Need SQl Query for Revenue Code and Revenue Amount in Receivables

    Hi,
    I need a SQL Query to develop data set for the following columns:
    Revenue Code,Revenue Code Description,Invoice Amount,Revenue Amount,Original Invoice Number,Original Invoice Date.
    Can i get from ra_cust_trx_line_gl_dist_all and ra_customer_trx_all and ra_customer_trx_lines_all by joining them.But for the columns whcih to take
    i am in dilemma.
    Kindly any help will be needful for me

    Hi,
    I need a SQL Query to develop data set for the following columns:
    Revenue Code,Revenue Code Description,Invoice Amount,Revenue Amount,Original Invoice Number,Original Invoice Date.
    Can i get from ra_cust_trx_line_gl_dist_all and ra_customer_trx_all and ra_customer_trx_lines_all by joining them.But for the columns whcih to take
    i am in dilemma.
    Kindly any help will be needful for me

  • SQL query to find Approved projects which are open

    Hi,
    Can anyone provide a SQL query which will show only the approved projects which are open.
    Thanks
    Titas

    Try this
    select PROJECT_ID , NAME from pa_projects_all
    where project_status_code = 'APPROVED'
    and NVL(CLOSED_DATE,SYSDATE+1) > SYSDATE
    Thanks
    Pradeep

  • I need sql query for this plz

    9.     DATA SET (ALIAS TBL)
    SSN     Name     Background Check Date     Review Date
    123456789     Bob Smith     4/15/04     5/10/05
    987654321     Sue Jones     12/2/05     3/4/06
    123456789     Bob Smith     12/31/05     NULL
    REQUIREMENTS
    Write a SQL statement that returns each employee name, their SSN, their most recent background check date, and the corresponding Review Date
    EXPECTED RESULTSET
    SSN     Name     Background Check Date     Review Date
    987654321     Sue Jones     12/2/05     3/4/06
    123456789     Bob Smith     12/31/05     NULL

    DATA SET (ALIAS TBL)
    ------------------------------------------------------------------------------------------------------------------|
    SSN     Name     Background Check Date     Review Date|
    -------------------------------------------------------------------------------------------------------------------|
    123456789     Bob Smith     4/15/04     5/10/05
    987654321     Sue Jones     12/2/05     3/4/06
    123456789     Bob Smith     12/31/05     NULL
    REQUIREMENTS
    Write a SQL statement that returns each employee name, their SSN, their most recent background check date, and the corresponding Review Date
    EXPECTED RESULTSET
    SSN      Name     Background CheckDate Review Date
    987654321     Sue Jones     12/2/05     3/4/06
    123456789     Bob Smith     12/31/05     NULL

  • For all of you who are having Motion Menu render problems - try this

    Just humour me for a minute.
    I have another Sonic application, and a known bug in the Motion Menu rendering applies to 29.97DF projects only.
    IE, NTSC.
    Often the video in a motion menu will fail to mux.
    There are workarounds though.
    1 - Make sure your GOP structure is 15 at most
    2 - Make certain the frame length of your video file is divisible by the GOP structure. IE, it must be a multiple of 15 frames.
    3 - if these both fail, reduce the bitrate of the video 500kbps at a time until it muxes. Most will work at 7,000, some need to be 6,000 and there are even times when you need to go as low as 4000.
    Try it - Encore uses a Sonic Authorcore, so it's worth a look.

    >Are you saying that NTSC 29.97 divided by 15 is okay?
    Not really.
    What I am saying is that your movie frame length should be divisible by the GOP structure with a GOP of 15.
    With NTSC video, you can have GOP lengths
    i up to
    18, but it is not mandatory to go to 18 - 15 is a perfectly acceptable figure. You could use a GOP of 12 if you really wanted to. What this means is typically the number of frames between I-Frames.
    MPEG-2 encoding (AKA "Moving Pictures by Educated Guesswork") P & B frames work something like this:
    i P-frames provide more compression than I-frames because they take advantage of the data in the previous I-frame or P-frame. I-frames and P-frames are called reference frames. To generate a P-frame, the previous reference frame is reconstructed, just as it would be in a TV receiver or DVD player. The frame being compressed is divided into 16 pixel by 16 pixel macroblocks. Then, for each of those macroblocks, the reconstructed reference frame is searched to find that 16 by 16 macroblock that best matches the macroblock being compressed. The offset is encoded as a "motion vector." Frequently, the offset is zero. But, if something in the picture is moving, the offset might be something like 23 pixels to the right and 4 pixels up. The match between the two macroblocks will often not be perfect. To correct for this, the encoder computes the strings of coefficient values as described above for both macroblocks and, then, subtracts one from the other. This "residual" is appended to the motion vector and the result sent to the receiver or stored on the DVD for each macroblock being compressed. Sometimes no suitable match is found. Then, the macroblock is treated like an I-frame macroblock. The processing of B-frames is similar to that of P-frames except that B-frames use the picture in the following reference frame as well as the picture in the preceding reference frame. As a result, B-frames usually provide more compression than P-frames. B-frames are never reference frames.
    In short, the I-Frame is the full description reference frame. A P frame is also a reference frame but describes the difference between the last I-Frame & itself. A good analogy is when you are on the telephone & describing what you see to a friend. The initial background description (The street, the sky, what you can see etc) would be an I-Frame. Then you describe a person walking down the street - that would be your P-Frames, as you are only describing the i changes
    in the scene.
    The bitrate can also affect things - I mentioned this too, and if a motion menu will not mux, first make sure that the film length is divisible by the GOP, and that the GOP is 15.
    If it
    i still
    won't mux, drop the bitrate by factors of 500 until it will.

  • Query for all hours in a month?

    Hello,
    I was hoping someone might be able to assist. I need to query for all the hours in a user specified date range (generally a month). For example,
    a query such as:
    select all hr_end from dual where start_date between '01-feb-2010' and '28-feb-2010'
    that returns:
    feb 01 2010 01:00
    feb 01 2010 02:00
    feb 01 2010 03:00
    feb 28 2010 23:00
    feb 28 2010 24:00
    Ideally, I want to be able to run this query within a WITH clause such that I can reference the temporary table/ list of hours in a subsequent select statement quickly. Something like:
    With
    all_hrs_in_month AS
    select .....
    where start_date between '01-mar-2010' and '31-mar-2010'
    I've looked around for similar questions, but have only found ones for all the 'days' in a month using level, connect by, row_num, for which I'm honestly not too familiar with and wasn't clear as to how I could modify to my needs.
    Greatly appreciate your help with this request.
    - j
    Edited by: user12942939 on Apr 5, 2010 12:04 PM

    Hi,
    Welcome to the forum!
    WITH     got_parameters  AS
         SELECT     TO_DATE ('01-mar-2010 00:00', 'dd-mon-yyyy hh24:mi')     AS start_date
         ,     TO_DATE ('31-mar-2010 23:00', 'dd-mon-yyyy hh24:mi')     AS end_date
         FROM     dual
    ,     all_hrs          AS
         SELECT     start_date + ( (LEVEL - 1)
                        / 24
                        )     AS hr
         FROM    got_parameters
         CONNECT BY     LEVEL <= 1 + ( 24
                                   * (end_date - start_date)
    SELECT       TO_CHAR (hr, 'DD-Mon-YYYY HH24:MI')     AS h
    FROM       all_hrs
    ORDER BY  hr
    ;Output:
    H
    01-Mar-2010 00:00
    01-Mar-2010 01:00
    01-Mar-2010 02:00
    01-Mar-2010 03:00
    31-Mar-2010 22:00
    31-Mar-2010 23:00Notice that start_date and end_date don't have to span then entire month; they don't even have to be in the same month.
    If you'd rather specify just one parameter (such as a single string containing the month and year):
    WITH     got_parameters  AS
         SELECT     TRUNC ( TO_DATE (:p_month, 'mon-yyyy')
                    , 'MONTH'
                    )          AS start_date
         ,     TRUNC ( ADD_MONTHS ( TO_DATE (:p_month, 'mon-yyyy')
                                 , 1
                    , 'MONTH'
                    )          AS end_date
         FROM     dual
    ,     all_hrs          AS
         SELECT     start_date + ( (LEVEL - 1)
                        / 24
                        )     AS hr
         FROM    got_parameters
         CONNECT BY     LEVEL <= ( 24          -- NOTE: Not adding 1 here
                               * (end_date - start_date)
    SELECT       TO_CHAR (hr, 'DD-Mon-YYYY HH24:MI')     AS h
    FROM       all_hrs
    ORDER BY  hr
    How It Works
    SELECT  LEVEL  AS n
    FROM    dual
    CONNECT BY  LEVEL <= x
    ;Produces a result set consiting of the integers 1, 2, 3, ..., x.
    There's nothing magical about the dual table; you can use any table AS LONG AS THE TABLE HAS ONLY ONE ROW .
    The other examples you saw probably just added this to a starting date, to get successive days, since, in Oracle date arithmetic, dt+n is a DATE n days after dt.
    Your case is slightly more complicated, because you want to add hours, not days. Since an hour is 1/24 of a day, we multiply by 24 to find how many integers to genereate, and divide by 24 when adding that number to the base date.
    Edited by: Frank Kulash on Apr 5, 2010 3:07 PM

  • Error while executing a sql query for select

    HI All,
    ORA-01652: unable to extend temp segment by 128 in tablespace PSTEMP i'm getting this error while i'm executing the sql query for selecting the data.

    I am having 44GB of temp space, while executing the below query my temp space is getting full, Expert please let us know how the issue can be resolved..
    1. I dont want to increase the temp space
    2. I need to tune the query, please provide your recomendations.
    insert /*+APPEND*/ into CST_DSA.HIERARCHY_MISMATCHES
    (REPORT_NUM,REPORT_TYPE,REPORT_DESC,GAP,CARRIED_ITEMS,CARRIED_ITEM_TYPE,NO_OF_ROUTE_OF_CARRIED_ITEM,CARRIED_ITEM_ROUTE_NO,CARRIER_ITEMS,CARRIER_ITEM_TYPE,CARRIED_ITEM_PROTECTION_TYPE,SOURCE_SYSTEM)
    select
    REPORTNUMBER,REPORTTYPE,REPORTDESCRIPTION ,NULL,
    carried_items,carried_item_type,no_of_route_of_carried_item,carried_item_route_no,carrier_items,
    carrier_item_type,carried_item_protection_type,'PACS'
    from
    (select distinct
    c.REPORTNUMBER,c.REPORTTYPE,c.REPORTDESCRIPTION ,NULL,
    a.carried_items,a.carried_item_type,a.no_of_route_of_carried_item,a.carried_item_route_no,a.carrier_items,
    a.carrier_item_type,a.carried_item_protection_type,'PACS'
    from CST_ASIR.HIERARCHY_asir a,CST_DSA.M_PB_CIRCUIT_ROUTING b ,CST_DSA.REPORT_METADATA c
    where a.carrier_item_type in('Connection') and a.carried_item_type in('Service')
    AND a.carrier_items=b.mux
    and c.REPORTNUMBER=(case
    when a.carrier_item_type in ('ServicePackage','Service','Connection') then 10
    else 20
    end)
    and a.carrier_items not in (select carried_items from CST_ASIR.HIERARCHY_asir where carried_item_type in('Connection') ))A
    where not exists
    (select *
    from CST_DSA.HIERARCHY_MISMATCHES B where
    A.REPORTNUMBER=B.REPORT_NUM and
    A.REPORTTYPE=B.REPORT_TYPE and
    A.REPORTDESCRIPTION=B.REPORT_DESC and
    A.CARRIED_ITEMS=B.CARRIED_ITEMS and
    A.CARRIED_ITEM_TYPE=B.CARRIED_ITEM_TYPE and
    A.NO_OF_ROUTE_OF_CARRIED_ITEM=B.NO_OF_ROUTE_OF_CARRIED_ITEM and
    A.CARRIED_ITEM_ROUTE_NO=B.CARRIED_ITEM_ROUTE_NO and
    A.CARRIER_ITEMS=B.CARRIER_ITEMS and
    A.CARRIER_ITEM_TYPE=B.CARRIER_ITEM_TYPE and
    A.CARRIED_ITEM_PROTECTION_TYPE=B.CARRIED_ITEM_PROTECTION_TYPE
    AND B.SOURCE_SYSTEM='PACS'
    Explain Plan
    ==========
    Plan
    INSERT STATEMENT ALL_ROWSCost: 129 Bytes: 1,103 Cardinality: 1                                                        
         20 LOAD AS SELECT CST_DSA.HIERARCHY_MISMATCHES                                                   
              19 PX COORDINATOR                                              
                   18 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10002 :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                         
                        17 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                    
                             15 HASH JOIN RIGHT ANTI NA PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,098 Cardinality: 1                               
                                  4 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 63 Bytes: 359,283 Cardinality: 15,621                          
                                       3 PX SEND BROADCAST PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                     
                                            2 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                
                                                 1 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621           
                                  14 NESTED LOOPS ANTI PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 40,256,600 Cardinality: 37,448                          
                                       11 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 6,366,160 Cardinality: 37,448                     
                                            8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1002               
                                                 7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 1 Bytes: 214 Cardinality: 2           
                                                      6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 1 Bytes: 214 Cardinality: 2      
                                                           5 INDEX FULL SCAN INDEX CST_DSA.IDX$$_06EF0005 Cost: 1 Bytes: 214 Cardinality: 2
                                            10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448                
                                                 9 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448           
                                       13 TABLE ACCESS BY INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT CST_DSA.HIERARCHY_MISMATCHES :Q1002Cost: 0 Bytes: 905 Cardinality: 1                     
                                            12 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT SYS.HIERARCHY_MISMATCHES_IDX3 :Q1002Cost: 0 Cardinality: 1                
                             16 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT CST_DSA.IDX$$_06EF0001 :Q1002Cost: 1 Bytes: 5 Cardinality: 1

  • Query to ignore the records which are 6 months older

    I need a query to ignore the records which are 6 months older . my table is having a column named quote_date . I need to ignore the records whose quote date is 6 months older . Can any one help me in this regard.
    thanks in advance
    rakesh

    Hi:
    SELECT *
      FROM table_name
    WHERE MONTHS_BETWEEN (SYSDATE, quote_date) > 6HTH
    Saad,

  • OIM sql Query for getting the status of the task which got failed

    Hi Everyone,
    We have a requirement like we need to get the status of a particular task(say Create User in OID resource - Completed\Rejected status) for the particular user.We are able to get the status of the resource provisioed to the user but not the status of the particular task getting trigerred for the user.can someone put some light on this.We need to get the SQL query for this.
    Thanks in Advance.
    Regards,
    MKN

    Hi
    Use this sample query to get the task status, also check the cooments
    SELECT USR.USR_LOGIN, OSI.SCH_KEY,SCH.SCH_STATUS,STA.STA_BUCKET FROM
    OSI,SCH,STA,MIL,TOS,PKG,OIU,USR,OBJ,OST
    WHERE OSI.MIL_KEY=MIL.MIL_KEY
    AND SCH.SCH_KEY=OSI.SCH_KEY
    AND STA.STA_STATUS=SCH.SCH_STATUS
    AND TOS.PKG_KEY=PKG.PKG_KEY
    AND MIL.TOS_KEY=TOS.TOS_KEY
    AND OIU.USR_KEY=USR.USR_KEY
    AND OIU.OST_KEY=OST.OST_KEY
    AND OST.OBJ_KEY=OBJ.OBJ_KEY
    AND OSI.ORC_KEY=OIU.ORC_KEY
    AND OBJ.OBJ_NAME='AD User'
    AND OST.OST_STATUS = 'Provisioning' -- filter accordinglly
    AND STA.STA_BUCKET = 'Pending' -- filter accordinglly
    AND PKG.PKG_NAME='AD User' -- filter accordinglly
    AND MIL.MIL_NAME='System Validation' ---- filter accordinglly
    Thanks,
    Kuldeep

  • SQL query to get a list of relations between workitems

    How can I create a SQL query to get a list of all problems with related changes?  And all problems with related incidents?
    I have tried to join the tables RelationshipTypeDim with ProblemDimKey and ChangeRequestDim, but the results are not correct.

    The relationships in the data warehouse can be kind of tricky. The relationships are contained in the WorkItemRelatesToWorkItemFactvw table. This table lists the related items by their WorkItemDimKey, so you cannot reference directly from the ChangeRequestDimvw
    or ProblemDimvw. You will need to reference the WorkItemDimvw to get the WorkItemDimKey for each entry.
    The query below will get all of the related work items from the Change Request class. The way the joins work is ChangeRequestDimvw gets the list of change requests. Then inner joins WorkItemDimvw to get the WorkItemDimKey for each CR. Then inner joins WorkItemRelatesToWorkItemFactvw
    to get all of the CRs with related work items. Then inner joins the WorkItemDimvw again to get the ID of the related work item. 
    Now the tricky part is it appears that these relationship are set based on which item  that created the relationship. So you need to union a second query that reverse the relationship on the WorkItemRelatesToWorkItemFactvw. 
    This query should give you a good start on getting the related work items. You can filter it down from here if you only want to include problems.
    SELECT C.ID, WIWI.ID
    FROM dbo.ChangeRequestDimvw C
    INNER JOIN dbo.WorkItemDimvw WI ON
    WI.EntityDimKey = C.EntityDimKey
    INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
    WIRWI.WorkItemDimKey = WI.WorkItemDimKey
    INNER JOIN dbo.WorkItemDimvw AS WIWI ON
    WIWI.WorkItemDimKey = WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey
    union
    SELECT C.ID, WIWI.ID
    FROM dbo.ChangeRequestDimvw C
    INNER JOIN dbo.WorkItemDimvw WI ON
    WI.EntityDimKey = C.EntityDimKey
    INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
    WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey = WI.WorkItemDimKey
    INNER JOIN dbo.WorkItemDimvw AS WIWI ON
    WIWI.WorkItemDimKey = WIRWI.WorkItemDimKey
    Order by C.ID
    Matthew Dowst |
    Blog | Twitter

Maybe you are looking for

  • How to restrict free goods determination based on item category

    Hi All, We have a process where when goods for a sales order are returned , we add a line item to same sales order with a return item category. The issue is we have free goods determination activated for this document type and it works even for the r

  • Data in table is huge so performance is reduced

    Hi all, I have a tables in the oracle database where the number of records in the table is huge ie 6 years of data,due to which when i generate the report the retrieval of data is slow. How to increase the performance,so that the report can be genera

  • Development over two system in the landscape

    Dear SolMan gurus. We face the following issue. Our customer wants to have 2 different systems in the landscape (CRM and R/3 system) under one project. How can we manage to create transport requests (TR) for both systems at onece. Or do I have to cre

  • ThinkPad 410 service complaint

    I have a thinkpad 410i that we purchased for my wife for Christmas last year.  This is the fourth thinkpad model I have had experience using (I have had a T40, T60 and currently have a T420 through work) and have always found the equipment to be top

  • How to control dynamically created symbols

    Hi, I'm new in edge but thanks to adobe forum that helped me a lot. I'm trying to use ".createChildSymbol" to bring my symbols from the library to my stage. And in each symbol I have an OUT label, so every time a new symbol is called by a particular