I am failing to understand the behavior of conditional join. Here is a comment table where there are two types of users. if the user\_type\_id=1 then the data should come from admins table, if the user\_type\_id=2 then the data should come from users table.

[![enter image description here](https://i.stack.imgur.com/s54XM.png)](https://i.stack.imgur.com/s54XM.png)

So I wrote the query as follows: 

```
 select a.name as admin_name, concat(u.first_name, ' ', u.last_name) as user_name, ptc.*
    from project_task_comments ptc 
    left join admins a on a.id= ptc.user_id and ptc.user_type_id=1
    left join users u on u.id=ptc.user_id and ptc.user_type_id=2
    and ptc.id=1

```

And Here is the result:

[![enter image description here](https://i.stack.imgur.com/k1r6Y.png)](https://i.stack.imgur.com/k1r6Y.png)

my question is why (in the result set) the row 3 and 5 has admin\_name and user\_name is null? Am I missing something?

admins table: 

```
+----+----------------+
| id | name           |
+----+----------------+
|  1 | ADMIN John Doe |
+----+----------------+

```

users table:

```
+----+------------+-----------+
| id | first_name | last_name |
+----+------------+-----------+
|  1 | User       | Alice     |
+----+------------+-----------+

```