A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"NOT" criteria



 
 
Thread Tools Display Modes
  #1  
Old September 13th, 2004, 09:24 PM
Liz Hansen
external usenet poster
 
Posts: n/a
Default "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  
Old September 13th, 2004, 09:36 PM
Liz Hansen
external usenet poster
 
Posts: n/a
Default

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  
Old September 13th, 2004, 09:48 PM
JL
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 07:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.