Re: Nested Query for newbie?

From: Steve Kass (skass_at_drew.edu)
Date: 05/14/04

  • Next message: Steve Kass: "Re: Select Statement"
    Date: Fri, 14 May 2004 16:29:45 -0400
    
    

    If you have a table with all the IDNum values (IDNum represents a pay
    period??), use it, or if not,

      (select Distinct IDNum from TblPayrolldetail) IDs

    where I have

      IDs

    select IDs.IDNum, [Tbl Employee] SSN
    from IDs, [Tbl Employee]
    where not exists (
      select * from TblPayrolldetail D
      where D.IDNum = IDs.IDNum
      and D.SSN = [TblEmployee].SSN
    )

    Steve Kass
    Drew University

    PM wrote:

    >Hi
    >thanks for reading
    >I have 2 tables. The first has employee information and
    >the second has
    >payroll information. I need to find out people who are not
    >in the
    >payroll but in the employee table.
    >Since the payroll has multiple instances i have to filter
    >it and find
    >out for each payroll.
    >I don't think i have explained it very well so here is the
    >data set.
    >hope someone can help me with this.
    >Thanks in advance
    >prit
    >
    >
    >Tbl Employee
    >PlanID SSN
    >1001 111111111
    >1001 222222222
    >1001 333333333
    >
    >TblPayrolldetail
    >IDNum PlanID SSN
    >1 1001 111111111
    >1 1001 222222222
    >2 1001 222222222
    >2 1001 333333333
    >
    >Required RESULT required(Missing employees for each pay
    >period)
    >IDNum SSN
    >1 333333333
    >2 111111111
    >
    >
    >


  • Next message: Steve Kass: "Re: Select Statement"