I have the following fields:
| employee_email | status | id |
| test1@test.com | active | 1 |
| test1@test.com | terminated | 2 |
| test2@test.com | active | 3 |
| test3@test.com | terminated | 4 |
| test4@test.com | terminated | 5 |
| test4@test.com | terminated | 6 |
I need to query with a rule that if there are more than 1 rows for the same employee_email (and one is active and one is terminated - then return just the row = active). IF more than 1 row and both are terminated, then return just one row that is terminated.
Output should be:
| employee_email | status | status |
| test1@test.com | active | 1 |
| test2@test.com | active | 3 |
| test3@test.com | terminated | 4 |
| test4@test.com | terminated | 5 |