Select employee where employee not in (select employee where con1=val1)

Hi Gurus,
I have a query which returns a list of employees who particpated in a particular plan(PLAN1). Now I need the list of all other employees who are not in the above list.
1. Restriction:  Plan <> 'PLAN1' does not work out for my requirement
2. I created a variable (VAR1) with replacement path by Query. But I cannot use this variable for Exclusion.
3. I created a customer exit variable with the idea of copying the values from (VAR1) and change the Sign to "Exclude". But the variable VAR1 (being a replacement path by query) is not being populated in list of variables i_t_var_range in the variable exit.
What are the other options that I can try out ? Please let me know.
Points for all the helpful answers are assured.
Thanks,
Giri.

Sorry for the delay. If I understand you correctly
E1 P1
E1 P2
E2 P1
E2 P2
E3 P2 ; your task is to fetch E3
In your first query you have already identified E1&E2 as having P1. E3 does not have P1. Thus use the 1st query as the replacement path  for the 2nd query. Except you  use <u>only</u> the employee characterstic  <u>not</u> the plan characterstic, as the replacement variable. This should fetch you E3

Similar Messages

  • Select lines from DB where keys not already selected

    This must have been asked many times, but I haven't been able to find an answer:
    How do I best select a large number of entries from a table X where the keys of X
    are not already cached in a (also large) internal table t?
    There are three possibilities I can think of, one of which doesn't actually work, although
    I think it should.
    1. Convert t to a range table, where all entries have the form sign=E option=EQ (or
    sign=I option=NE - I'm confused about the difference in meaning. Which is right?)
    2. Use "for all entries". The documentation of FAE leads me to believe that this
    should be possible, because the docs only talk of using logical expressions in general
    with FAE, not equality specifically. However, using inequality does not give the right result,
    i. e.
    select * from X for all entries in t where k NE t-k
    does not work. Am I missing something?
    3. Do a select loop and read t before accepting a line. Although t is a hash table, this is
    probably the worst as regards performance.
    -- Sebastian

    In the 2nd option, just check the statment
    select * from X into table itab for all entries in t where k NE t-k

  • SELECT * FROM table WHERE id NOT IN?  Help with statement.

    Hi,
    Two tables. Orders (orderID = PK) and Paid Orders (orderID =
    FK)
    I want to display a recordset of orders from the Orders table
    where the
    order ID doesn't appear in the Paid Orders table.
    I have tried something like this:
    SELECT *
    FROM dbo.tblOrders
    WHERE orderID NOT IN ( SELECT TOP 100 PERCENT
    tblPaidOrders.orderID FROM
    dbo.tblPaidOrders )
    ...no joy with that though. Would appreciate some guidance.
    Thank you.
    Regards
    Nath.

    Hi Nancy,
    Before I begin that, can I ask if there is an issue with the
    OR?
    I need it to be:
    (orderID IN (SELECT qryPaidOrders.orderID FROM qryPaidOrders)
    ORDER BY
    orderdate ASC) AND ((customerid = MMColParam1) OR (vanopID =
    MMColParam2))
    MMColParam1 is exactly the same as MMColParam but, for some
    reason
    unbeknowns to me, DW8.0.2 won't allow me to use it twice.
    That's neither
    here nor there though, as creating a 2nd variable
    (MMColParam2) solves that
    particular issue.
    Do I need additional ( ) anywhere considering it is an OR
    though?
    Thanks.
    nath.
    "Nancy *Adobe Community Expert*" <[email protected]>
    wrote in message
    news:[email protected]...
    >I would think so .. now that you have the core statement
    working .. try
    >adding the other portions. Put the main statement in ( )
    and add the
    >others. Like this:
    >
    > SELECT *
    > FROM dbo.qryOrders
    > WHERE (orderID IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    > ORDER BY orderdate ASC) AND (customerid = MMColParam1)
    AND (vanopID =
    > MMColParam2)
    >
    > See what that gives you and fiddle with those till you
    get what you want.
    >
    >
    > --
    > Nancy Gill
    > Adobe Community Expert
    > BLOG:
    http://www.dmxwishes.com/blog.asp
    > Author: Dreamweaver 8 e-book for the DMX Zone
    > Co-Author: Dreamweaver MX: Instant Troubleshooter
    (August, 2003)
    > Technical Editor: DMX 2004: The Complete Reference, DMX
    2004: A
    > Beginner's
    > Guide, Mastering Macromedia Contribute
    > Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced
    PHP Web
    > Development
    >
    >
    >
    >
    > "tradmusic.com" <[email protected]> wrote
    in message
    > news:[email protected]...
    >> Hi,
    >>
    >> After a bit of twiddling, I changed the statement to
    this:
    >>
    >> SELECT *
    >> FROM dbo.qryOrders
    >> WHERE orderID IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    >> ORDER BY orderdate ASC
    >>
    >> ...and it displays only those records who appear in
    the Paid Orders
    >> table. If I change this to NOT IN, it displays only
    the orders in the
    >> Orders table.
    >>
    >> Ideal, but I need to apply the customerID and
    vanopID variables....is
    >> that possible within this one statement?
    >>
    >> Really appreciate the help,
    >> Regards
    >> Nath.
    >>
    >> "Nancy *Adobe Community Expert*"
    <[email protected]> wrote in message
    >> news:[email protected]...
    >>> You've added to it since the first post. Take
    out the customerID and
    >>> vanopID parts and try focusing on just the
    orderID part. Get that
    >>> working first.
    >>>
    >>> I would try seeing if you can select those
    orderID's that are IN the
    >>> subquery first .. that would see whether or not
    the problem is the NOT
    >>> .. which should work .. but let's see first
    whether the culprit is the
    >>> query structure or not. See if you can select
    the orderID's that are in
    >>> the paid orders table from the main query.
    >>>
    >>>
    >>> --
    >>> Nancy Gill
    >>> Adobe Community Expert
    >>> BLOG:
    http://www.dmxwishes.com/blog.asp
    >>> Author: Dreamweaver 8 e-book for the DMX Zone
    >>> Co-Author: Dreamweaver MX: Instant
    Troubleshooter (August, 2003)
    >>> Technical Editor: DMX 2004: The Complete
    Reference, DMX 2004: A
    >>> Beginner's
    >>> Guide, Mastering Macromedia Contribute
    >>> Technical Reviewer: Dynamic Dreamweaver MX/DMX:
    Advanced PHP Web
    >>> Development
    >>>
    >>>
    >>> "tradmusic.com"
    <[email protected]> wrote in message
    >>> news:[email protected]...
    >>>> Hi Nancy,
    >>>>
    >>>> Have just tried that, but it is still
    displaying records whose orderID
    >>>> is also in a record in the Paid Orders
    table?
    >>>>
    >>>> I've got:
    >>>>
    >>>> SELECT *
    >>>> FROM dbo.qryOrders
    >>>> WHERE customerID = MMColParam OR vanopID =
    MMColParam1 AND orderID NOT
    >>>> IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    >>>> ORDER BY orderdate ASC
    >>>>
    >>>> Hope you can help.
    >>>> Thanks. :o)
    >>>> Nath.
    >>>>
    >>>>
    >>>> "Nancy *Adobe Community Expert*"
    <[email protected]> wrote in message
    >>>> news:[email protected]...
    >>>>> Why couldn't your inner query just be
    SELECT orderID from
    >>>>> dbo.tblPaidOrders? Wouldn't the top 100%
    be all of them?
    >>>>>
    >>>>>
    >>>>> --
    >>>>> Nancy Gill
    >>>>> Adobe Community Expert
    >>>>> BLOG:
    http://www.dmxwishes.com/blog.asp
    >>>>> Author: Dreamweaver 8 e-book for the DMX
    Zone
    >>>>> Co-Author: Dreamweaver MX: Instant
    Troubleshooter (August, 2003)
    >>>>> Technical Editor: DMX 2004: The Complete
    Reference, DMX 2004: A
    >>>>> Beginner's
    >>>>> Guide, Mastering Macromedia Contribute
    >>>>> Technical Reviewer: Dynamic Dreamweaver
    MX/DMX: Advanced PHP Web
    >>>>> Development
    >>>>>
    >>>>>
    >>>>> "tradmusic.com"
    <[email protected]> wrote in message
    >>>>>
    news:[email protected]...
    >>>>>> Hi,
    >>>>>>
    >>>>>> Two tables. Orders (orderID = PK)
    and Paid Orders (orderID = FK)
    >>>>>> I want to display a recordset of
    orders from the Orders table where
    >>>>>> the order ID doesn't appear in the
    Paid Orders table.
    >>>>>>
    >>>>>> I have tried something like this:
    >>>>>>
    >>>>>> SELECT *
    >>>>>> FROM dbo.tblOrders
    >>>>>> WHERE orderID NOT IN ( SELECT TOP
    100 PERCENT tblPaidOrders.orderID
    >>>>>> FROM dbo.tblPaidOrders )
    >>>>>>
    >>>>>> ...no joy with that though. Would
    appreciate some guidance. Thank
    >>>>>> you.
    >>>>>>
    >>>>>> Regards
    >>>>>> Nath.
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >>
    >
    >

  • Select data from table not in another table

    Hi,
    I want to select data from table A which is not in table B.
    Currently I am doing:
    select
    snoA,
    nameA,
    dobA
    from A
    where snoA not in
    (select snoB from A, B
    where snoA = snoB
    and nameA = nameB)
    But above is very slow.
    Can I do something like:
    select
    snoA,
    nameA,
    dobA
    from A, B
    where
    EXCLUDE ( snoA = snoB and nameA = nameB)
    Please note that I need the where condition on both the columns.
    any help will be appreciated.
    -- Harvey

    What are the approximate data volumes in A and B?
    What is "very slow"?
    What version of Oracle?
    What is the query plan?
    Without knowing anything about your system, my first thought would be to see if a NOT EXISTS happened to be faster for your data
    SELECT snoA,
           nameA,
           dobA
      FROM a
    WHERE NOT EXISTS (
        SELECT 1
          FROM b
         WHERE a.snoA = b.snoB
           AND a.nameA = b.nameB )Of course, I'm not sure why you are joining A & B in your NOT IN subquery. It would seem like you would just need a correlated subquery, i.e.
    SELECT snoA,
           nameA,
           dobA
      FROM a
    WHERE snoA NOT IN (
        SELECT snoB
          FROM b
         WHERE a.snoA = b.snoB
           AND a.nameA = b.nameB )That should be more efficient than the original query. The NOT EXISTS version may or may not be more efficient than the NOT IN depending on data volumes.
    Justin

  • INCLUDE BDCRECX1 not displaying selection text in selection screen.

    In my BDC program in using INCLUDE BDCRECX1, When i execute program in selection screen i am not getting selection texts.
    what is the problem?

    You are not getting selection texts because you have not maintained text symbols in your BDC program,

  • WHERE rowID NOT IN (another recordset on same page?)

    Hi.
    I have a recordset that lists movie reviews.  On the same page, I have a menu that lists movies, for review.
    I want to hide movies, in that list, if they already exist in the users recordset of reviews.
    In other words, if the user has already submitted a movie review, I don't want them to be able to submit another review for the same movie.
    As I understand it, I can use the NOT IN function in my SELECT statement for my movie recordset, but I'm not sure how to call the movieID from the review recordset, in this statement.
    I'm aiming for something like this:
    rsUserReviews
    reviewID
    movieID
    rsMovies
    movieID
    In the movie recordset I need to do something like this:
    SELECT movieID, moviename FROM dbo.movies WHERE movieID NOT IN (SELECT movieID FROM rsUserReviews)
    Is this possible?
    Appreciate any advice.  Thanks.
    Nath.

    Hi David.  Sincere apologies.  That is a bad habit of mine.
    I'm using Classic ASP / VBScript.
    So you're suggesting:
    SELECT movieID FROM dbo.movies WHERE movieID NOT IN (SELECT dbo.reviews.userID, dbo.reviews.movieID FROM dbo.reviews WHERE dbo.reviews.userID = ?)
    Do I just add another parameter, in the movie recordset, to accommodate the userID reference?
    When I try that, I get this:
    [SQL Server]Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
    Hope you can help.  Thank you.
    Regards
    Nath.

  • Where x Not In Collection?

    Hey everybody,
    is there a way to get this query working?
    >
    declare
    list_p APEX_APPLICATION_GLOBAL.VC_ARR2:=APEX_UTIL.STRING_TO_TABLE('23:24');
    begin
    DELETE FROM y WHERE x NOT IN (SELECT * FROM list_p);
    end;
    >
    The only solution i found is to loop the list_p everytime, but doesnt work fine for me.
    Thanks in advance.

    Write pipeline function that takes takes the string to split , pipes the split segments(table of string type ) .
    Use the pipeline function in the query.

  • A report that lists all non-exempt employees that do not have a supervisor

    HI all,
    Please help. This is urgent.
    bold "A report that lists all non-exempt employees that do not have a supervisor assigned in R/3." bold
    I have already selected non-exempt employees but don't know how to select people who do not have a supervisor" What selection criteria I should choose in the ad-hoc query
    Thanks a bunch,
    Rashmi

    Hi
    Actually its not that difficult. You can give a criteria in selection where relationship A002 is equal to a space . Replace A002 in this example with the relatioship you have defined for 'Reports(line) to'.
    Regards
    Waz

  • How to list those employees who do not have a certain pay rate type set up

    Hi,
    I'm trying to create a report that lists all employees who DO NOT have a certain pay rate role type set up.  An employee can have multiple pay rate roles - for example: chargeable miles, non-chargeable miles, subsistence, etc.
    I want to identify all those employees who do not have, say, subsistence yet set up.
    I joined the employee table to the employee rates table. The employee_role_id=20 is the particular rate role value that I am interested in. I want to only list those employees who do not have rate of role type 20 set up. That way I can go and set one up for these employees.  At present, I am using selection criteria where employee_role_id=20. This brings back only those employees that have an employee_role_id of 20 setup. I would like to do the inverse but setting <>20 only screens out those roles with value 20 and displays all of the rest of the pay role values for each employee.
    Any help is appreciated.
    thx!
    Mark

    if you are not sure about the linking i suggest to just show all roles associated to all the employees,
    group by employee
    create true/false formula for the role_ids  where ONLY your 20 role is TRUE per employee
    then exclude all false - that should give you only the employees that are missing that particular role.

  • How to return employees who did not register?

    Hi All.
    I've tow tables, employees (for data of employees) and emp_comm(emp_no number, comm_date date) for registering coming
    emp_no in emp_comm table is a foreign key references to the primary one emp_no in employees.
    Now I tried to use this code in a report to return all employees who didn't register between tow dates (using user parameters):
    select a.FINANCIAL_NO ,  a.emp_full_name, b.xdate from
    employees a,
    (select to_date(:P_FROM,'dd/mm/yyyy') + (level-1) xdate  
    from dual
    connect by level <= to_date(:P_TO,'dd/mm/yyyy')-to_date(:P_FROM,'dd/mm/yyyy')+1
    ) b
    where (A.EMP_NO, b.xdate) not in (select EMP_NO, TO_DATE(COMM_DATE, 'DD/MM/YYYY') from EMP_COMM)
    But the previous code returns all the employees not only who not register! Why? and How to solve?
    Thank you
    Note: I'm using DB 10g, Reports 6i
    Out Of Stock

    Hello,
    in your query
    FROM    employees a
          ,(SELECT TO_DATE(:p_from,'dd/mm/yyyy') + (LEVEL - 1) xdate
            FROM    dual
            CONNECT BY LEVEL <= TO_DATE(:p_to,'dd/mm/yyyy') - TO_DATE(:p_from,'dd/mm/yyyy') + 1
            ) b
    gives a cartesian product - every employee with every date
    Since comm_date matches only a single date in b you get a NOT IN for every other date.
    Try
    SELECT  a.financial_no
          ,a.emp_full_name
    FROM    employees a
    WHERE  a.comm_date NOT BETWEEN TO_DATE(:p_from,'dd/mm/yyyy')
                AND TO_DATE(:p_to,'dd/mm/yyyy')
    What do you need b.xdate for in your example?
    BTW: Isn't comm_date a date column? TO_DATE on a date column is wrong, it might give you wrong results because it will implicitly converted to TO_DATE(TO_CHAR(comm_date),'dd/mm/yyyy') where the TO_CHAR uses the default date format.
    Regards
    Marcus

  • Chief HR officer not showing all employees

    Dear Experts,
    I have setup HR intelligence and i am having a problem in HR Chief Responsibility. The responsibility is not showing complete employees of the organisation(in Overview). Can anybody help me out on this one.
    regards,
    Muhammad Noman Shafique

    Couple of things I can think of -
    #1.If you're looking at headcount under a person(manager), make sure all the employees under him have the supervisor data.
    Even if one link is broken in the hierarchy, it might not give you the correct headcount.
    So just check all the employees whi have no Supervisor and update them.
    #2. Same with Location. If you're looking at the employee count per location, make sure the value is populated for all employees.
    All the data you see in the Dashboard comes from HRI% views
    select * from all_views
    where view_name like 'HRIBG%';
    select * from all_views
    where view_name like 'HRI%';
    So you can check the appropriate View and see why the view is not returning data.
    Sorry mate, cant be of more help.. Not sure why it isn't showing the data..
    Cheers,

  • Query on Cats data, employees that have not filled in their data.

    Hi,
    I have to create a query that will report on all the employees that have not filled in their timesheets. The 0CATS_C01 cube does not contain that data, it only has the employees that have filled in their  timesheets.
    The route I have decided to take with this requirement is to create a cube with each employee and ecah day of the year and then create a multiprovider with the 0CATS_C01 cube and create an exception report with this multiprovider. I am not sure that this is the best way to go about this report.
    However I am stuck at the new employee cube - I don't know how to add a record for each employee and each day to the cube.
    Experts, could you please suggest a  better way of developing this query, and also a solution to adding a record for each employee and each day of the year, I think that I could do this in the "Start Routine" of the update rule, but am uncertain.
    Please help.
    Thanks in advance !

    I have not worked with CATS data, but consider an InfoSet of employee and the InfoCube. This would provide a list of all emplyees and their CATS data. Create a query, and select by time, and filter by a key figure in the CATS infoCube < 1.
    Also consider using a one characteristic DSO instead of the employee master data of "active" employees and using that in the InfoSet. (We probably don't need to know that an an employee who quit six months ago did not fill in his time sheet!)
    Good luck,
    John Hawk

  • Cycle Count Entries Form not showing specific employee name in "Counted By" LOV List

    Cycle Count Entries Form not showing specific employee name in "Counted By" LOV List.But the Employee is active . Is there any setup for this activity?

    Hi,
    This is because the query is excluding the current site you are trying to modify since it is actually in the report.
    You can include in your query:
    or site_id = :Pxx_SITE_ID
    Where Pxx_SITE_ID is the item holding the site_id value and xx is your page number.
    Thank you,
    Erick

  • Block the processing of payroll for employees who do not have IT0185 ST01

    Hi People.
    I have a client requirement that payroll should be processed only for those persons for whom ID number (IT0185-ST01) is available. I am trying to do it for Portugal Payroll.
    I activated P0185 function in PE04 for Portugal and created 2 rules:
    *ZH01 Verifica existência do IT0185*
    *TABLEP0185 Ler campos de tabela*
    *" VARGBSUBTY Campo tab.VVVVV ArgV*
    *" 01*
    *NUM=1 Definir*
    *ADDWT&0185 VAR tab.variáveis*
    and...
    *ZH02 Verifica existência do IT0185 Subtipo 01*
    *NUM=& 0185 Definir*
    *" NUM?0 Comparação*
    *ZERO=&0185 Definir VVVV p/zero*
    *" =*
    *ERROR Cancel.processamento*
    And I put the rules in sequence in the scheme. But the function P0185 doesn't accept rules.
    How do I block the processing of payroll for employees who do not have infotype 0185 subtype 01?
    Thanks,
    Helio Rabello

    if you are not sure about the linking i suggest to just show all roles associated to all the employees,
    group by employee
    create true/false formula for the role_ids  where ONLY your 20 role is TRUE per employee
    then exclude all false - that should give you only the employees that are missing that particular role.

  • Contact persons which are created in ECC but not replicated as  employee

    Dear Experts,
    Where can i find the contact persons which are created in ECC but not replicated as  employee in the CRM.
    For example i created the 10000 personal no in that 800 should replicate to the CRM from  ECC but only 600 is replicated and  remaining 200 i have to find in the ECC to replicate again running PFAL.
    If i have to down lode and compare in excel please provide the details. in which tables i have to down load in ECC and CRM which what input.
    Best Regards,
    Siva Anjith

    Dear Gurus,
    Can you please help to resolve my replication issue.
    Best Regards,
    Siva Anjith

Maybe you are looking for