Mysql – Query to join three tables

join;MySQL

I have three tables which I have to join. I'm not a good SQL writer. Can please sombody help me to prepare this using joins:

branches
-----------------------------------------
branch_id | branch_name | branch_address
-----------------------------------------

branch_services
-------------------------------
bs_id | branch_id | service_id
-------------------------------

services
--------------------------
service_id | service_name
--------------------------

I need to select * from the branches table and service_names related to each branch.

Best Answer

select 
    b.*,
    s.service_name
from 
    branches b,
    branch_services bs,
    services s
where
    b.branch_id=bs.branch_id 
    and bs.service_id=s.service_id