Retrieve non equal rows between two queries

  • Thread starter Thread starter George Lattanzio
  • Start date Start date
G

George Lattanzio

Guest
Hi, I need some help trying to get the difference in rows between two queries. I have two queries, one contains the entire employee population and the other only contains a small selection of employees who have taken a course. I can't seem to get a sub query to work by using NOT IN. My SQL code below, I get a query to complex error.

Thanks

SELECT Training_qry.[EMPL #], Training_qry.EMPLOYEE
FROM Training_qry
WHERE Training_qry.[EMPL #]
NOT IN (SELECT MGR_Trained_qry.[EMPL #]
FROM MGR_Trained_qry
WHERE Training_qry.[EMPL #] <> MGR_Trained_qry.[EMPL #] );
 
Pat or whoever feels they can answer this

I have a primary key in a table that is based on multiple field basis

'tbl_flags' has primary key of 'cr_no' and 'flag_code' combined.

I have another table, d2Kflags that contains imported data containing 'CR no' and 'flag code'

I want to sucessfully append data from d2kflags to tbl_flags where both of the column values DO NOT match

So if a combination of 'CR no' and 'flag code' exists in the source table, (d2kflags)and it already exists in the target table (tbl_flags)then it will ignore it and move onto the next row

I beleive that a subquery can be used but I cant for the life of me work out the syntax

I tried your solution of unmatched queries as suggested in the reponse above, but it appears as though you can only do one field, where as I guess I need two for this one.

I hope you can help

Toni


[This message has been edited by Ice Rhino (edited 02-24-2002).]
 

Users who are viewing this thread

Back
Top Bottom