show records when two fields not equal

T

Tina S

I am trying to build a report about reviews done on employees. We have
Managers assgined to Employees that do reviews. Sometimes we have manager
who are NOT assigned to an employee do a review. I want to be able to find
these records.

So I need the records for when a non-assigned manager reviews a non-assigned
employee.

Employee 1 assigned to Mgr 1
Employee 1 reviewed by non assigned Mgr 2
 
J

Jeff Boyce

"how" depends on "what" ... and we don't know what data you're working with.

More info, please...

(for example, what tables do you find the data in?)

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
K

KARL DEWEY

I am assuming that all review records are in a single table --
SELECT FName, LName, EmployeeID, tblEmployeeReview.Reviewer, [XX].Reviewer
FROM (tblEmployee LEFT JOIN tblEmployeeReview ON
tblEmployee.EmployeeID = tblEmployeeReview.EmployeeID) LEFT JOIN
tblEmployeeReview AS [XX] ON tblEmployee.EmployeeID = [XX].EmployeeID
WHERE tblEmployeeReview.Reviewer <> [XX].Reviewer;
 
T

Tina S

This is a bit complicated for me. Let me give you some more information and
maybe you can use it to help me understand.

I have tblReview with EMP and MGR fields. This is the review table.

I have tblHierachy with EMP and MGR. This is the Hierarchy table showing
the Manager and the Employees assigned to them.

When you give me the information, do I open a new query, go in the SQL view
and put in in there?

Thanks for your help and patience.


KARL DEWEY said:
I am assuming that all review records are in a single table --
SELECT FName, LName, EmployeeID, tblEmployeeReview.Reviewer, [XX].Reviewer
FROM (tblEmployee LEFT JOIN tblEmployeeReview ON
tblEmployee.EmployeeID = tblEmployeeReview.EmployeeID) LEFT JOIN
tblEmployeeReview AS [XX] ON tblEmployee.EmployeeID = [XX].EmployeeID
WHERE tblEmployeeReview.Reviewer <> [XX].Reviewer;

--
Build a little, test a little.


Tina S said:
I am trying to build a report about reviews done on employees. We have
Managers assgined to Employees that do reviews. Sometimes we have manager
who are NOT assigned to an employee do a review. I want to be able to find
these records.

So I need the records for when a non-assigned manager reviews a non-assigned
employee.

Employee 1 assigned to Mgr 1
Employee 1 reviewed by non assigned Mgr 2
 
P

PieterLinden via AccessMonster.com

Tina said:
This is a bit complicated for me. Let me give you some more information and
maybe you can use it to help me understand.

I have tblReview with EMP and MGR fields. This is the review table.

I have tblHierachy with EMP and MGR. This is the Hierarchy table showing
the Manager and the Employees assigned to them.

When you give me the information, do I open a new query, go in the SQL view
and put in in there?

Thanks for your help and patience.
I am assuming that all review records are in a single table --
SELECT FName, LName, EmployeeID, tblEmployeeReview.Reviewer, [XX].Reviewer
[quoted text clipped - 13 lines]

Looks like this works:

SELECT DISTINCT Review.ReviewID, Employee.EmployeeID, Employee.ManagerID,
Reviewer.ManagerID AS ReviewerID
FROM Employee AS Manager INNER JOIN (Employee INNER JOIN (Employee AS
Reviewer INNER JOIN Review ON Reviewer.ManagerID = Review.Mgr) ON Employee.
EmployeeID = Review.Emp) ON Manager.EmployeeID = Employee.ManagerID
WHERE (((Reviewer.ManagerID)<>[Employee].[ManagerID]));

If you open a new query and copy and paste the SQL into it, you can view the
joins in the top window.
The query SQL is confusing because of all the aliasing going on. The picture
is much clearer.

run that on a small subset of your data and see if that works. (It's just
easier to proof on a couple of records instead of hundreds)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top