Reputation: 1
I have a table:
Alias
, Manager
, Auditor
, Activator
The Alias
is unique.
Scenario: an employee needs to get his/her account reactivated. To do this they must go through a process of verification.
The table will then place an alias number into each column ( manager, auditor, activator) of whomever does the request. By rule employee cannot use his or herself to activate their own account.
How can i write a query to list all rows and columns displaying an employee having their alias showing up under manager and auditor, or manager and activator? ( in other words they are breaking the rules and verifying themselves)
Upvotes: 0
Views: 38
Reputation: 1079
From your statement
alias showing up under manager and auditor, or manager and activator
SELECT alias, manager, auditor, activator
FROM Employees
WHERE (manager = alias AND auditor = alias) OR (manager = alias AND activator = alias)
Upvotes: 0
Reputation: 1352
Is the rule you're looking for that the alias needs to be different to the manager, auditor and activator values?
If so, could you try a query like this?
SELECT alias, manager, auditor, activator
FROM employees
WHERE alias = manager
OR alias = auditor
OR alias = activator;
Upvotes: 0