If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"NOT" criteria
Hello,
I need to compare two tables. When compared, if an employeeID is missing from the tblDemographics, it should be added using an append query. I'm obviously doing something wrong cause' right now it can't find the missing records... Tables: Employee (main table with all records) tblDemographics (may have missing records) Field: employeeid This is the SQL statement so far: SELECT employee.employeeid FROM employee INNER JOIN tblDemographics ON employee.employeeid = tblDemographics.EmployeeID WHERE ((Not (tblDemographics.EmployeeID)=[tblDemographics]![EmployeeID])) GROUP BY employee.employeeid; Any help is very much appreciated. Best, Liz |
#2
|
|||
|
|||
Never mind everyone.
Found it. Thanks! :-) "Liz Hansen" wrote in message ... Hello, I need to compare two tables. When compared, if an employeeID is missing from the tblDemographics, it should be added using an append query. I'm obviously doing something wrong cause' right now it can't find the missing records... Tables: Employee (main table with all records) tblDemographics (may have missing records) Field: employeeid This is the SQL statement so far: SELECT employee.employeeid FROM employee INNER JOIN tblDemographics ON employee.employeeid = tblDemographics.EmployeeID WHERE ((Not (tblDemographics.EmployeeID)=[tblDemographics]![EmployeeID])) GROUP BY employee.employeeid; Any help is very much appreciated. Best, Liz |
#3
|
|||
|
|||
1) If you are doing a join, you have to do LEFT JOIN.
Go to design mode in the query. Right click on the relationship in the table above and select "Join Property". Click on include all record from teh Master (Employee) and .... 2) Change you WHERE clause to tblDemographics.EmployeeID is null (or = ""). I think that should work. SELECT employee.employeeid FROM employee LEFT JOIN tblDemographics ON employee.employeeid = tblDemographics.EmployeeID WHERE tblDemographics.EmployeeID is null; -----Original Message----- Hello, I need to compare two tables. When compared, if an employeeID is missing from the tblDemographics, it should be added using an append query. I'm obviously doing something wrong cause' right now it can't find the missing records... Tables: Employee (main table with all records) tblDemographics (may have missing records) Field: employeeid This is the SQL statement so far: SELECT employee.employeeid FROM employee INNER JOIN tblDemographics ON employee.employeeid = tblDemographics.EmployeeID WHERE ((Not (tblDemographics.EmployeeID)= [tblDemographics]![EmployeeID])) GROUP BY employee.employeeid; Any help is very much appreciated. Best, Liz . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Specifying no criteria in a query | Big Tony | Running & Setting Up Queries | 1 | August 12th, 2004 01:09 AM |
IIf statement in Criteria | Brent_Fanguy | Running & Setting Up Queries | 3 | June 22nd, 2004 10:17 PM |
DSUM Criteria and Excel Help | Earl Kiosterud | Worksheet Functions | 2 | April 30th, 2004 07:55 PM |
Countif functions with multiple criteria | Jason Morin | Worksheet Functions | 3 | April 5th, 2004 08:46 PM |
Countif functions with multiple criteria | t | Worksheet Functions | 0 | April 5th, 2004 07:11 PM |