hello folks can anyone tell me what is this best way i mean any other way which will have less line of code as compare to this let me show query first 

```
 select agent.*, count(que.id)  queue_count    
 from table agent 
 left join (select * from table2 q 
            INNER JOIN table3 p on q.path_id=p.id 
            where q.status=1 p.name='demo') que 
   on que.agent_id=agent.id 
 left join table3 path on path.id=que.path_id    
 group by agent.id 
 order by queue_count

```

i have 3 table now i want to join all table and inner select again i m join 2 table i.e table 2 and 3 with where clause