Reputation: 172
I want to return data wherein the employee who created the ticket is not the same as the employee who updated it.
This is what the data looks like:
Tickets | Created_by | Updated_by
Tick-1 | John | John
Tick-2 | Mike | Mike
Tick-3 | Carl | Amir
Tick-4 | Amir | Carl
Expected Output:
Tickets | Created_by | Updated_by
Tick-3 | Carl | Amir
Tick-4 | Amir | Carl
Tick1
& Tick2
were removed because the Row value in Created_by and Updated_by are the same.
I have a workaround that looks something like this:
SELECT Tickets, Created_by, Updated_by
FROM table
WHERE Created_by = 'John' AND Updated_by != 'John'
But the issue is I have to do it 1 by 1 per each person and we have hundreds of them.
Upvotes: 1
Views: 66
Reputation: 54
Select Tickets, Created_by, Updated_by
From TABLENAME
Where Created_by != Updated_by
Try this, hope this help you
Upvotes: 1
Reputation: 17126
Why don't you try something like this
SELECT Tickets, Created_by, Updated_by
FROM table
WHERE Created_by <> Updated_by
Upvotes: 4