I have this `Student` table:

```
Id   companyId    status
----------------------------------------
101  1001         In-Progress
102  1001         In-Progress
103  1001         Final
104  1002         In-Progress   
105  1003         Pending With Company 
106  1003         In-Progress
107  1004         In-Progress
108  1004         In-Progress 
109  1005         In-Progress
110  1005         Completed
111  1006         In-Progress
112  1006         Canceled
113  1007         In-Progress
114  1007         Pending with Student 

```

I want output with these conditions:

1. Status is "In-Progress"
2. If have repeated companyId then other allowed staus is Completed, Canceled (Basically only allowed combination of the staus is In-Progress, Completed and Canceled)

With above condition o/p will look like this:

```
Id   companyId    status
--------------------------------
104  1002         In-Progress   
107  1004         In-Progress
108  1004         In-Progress 
109  1005         In-Progress
111  1006         In-Progress

```

We can achieve this by using NOT IN

```
SELECT * 
FROM student
WHERE status = 'In-Progress' 
  AND companyId NOT IN (SELECT companyId FROM student 
                        WHERE status IN ('Final', 'Pending With Company ', 'Pending with Student'));

```

But I'm looking for a solution without using `NOT IN`.