MySQL left join with multiple views MySQL left join with multiple views database database

MySQL left join with multiple views


You can use left join by putting vw_clients in the first in the from list, then all other tables followed after left join. The left join can join only two tables or one "result set" and a table,where the result set is the result of the former join.

In your case:

SELECT     T0.client_id, name, exts, vms, ivrs, queues, conf10, conf20, conf30FROM     vw_clients T0    left join  vw_exts T1 on T0.client_Id=T1.client_id    Left join  vw_vms T2 on ...    ...Where ...

Maybe here you don't need where clause.


Yes, you’d just replace your WHERE with a LEFT JOIN.

LEFT JOIN vw_exts ON vw_clients.client_id = vw_exts.client_id

Then you can remove those extra tables from the FROM part.