I need a query that will show only employees who have been paid in more than one state.
The query will pull three columns:
- EmployeeID
- WorkLocation
- LastPayDate
My current, unsuccessful attempt:
Select EmployeeID
, WorkLocation
, max(LastPayDate)
from Table
group by EmployeeID, WorkLocation
having COUNT(distinct WorkLocation) > 1
This query pulls zero records. I know there are employees who have worked in multiple states, however. I am not sure where my logic breaks down.
Any instruction is much appreciated.