How to join two tables mysql?
I have two tables:
开发者_如何学Cservices
- id
- client
- service
and
clients
- id
- name
How to list table service and bring together the customer name that the customers table? field customer services in the table has the id of the customer at the customer table,
I appreciate the help from you now
SELECT * FROM table1 LEFT JOIN table2 on table1.id = table2.id
SELECT ...
FROM services AS s
JOIN clients AS c
ON s.client = c.id
WHERE ...
SELECT ...
FROM services AS s
INNER JOIN clients AS c
ON s.client=c.id
Try this,
SELECT * from services as s INNER JOIN clients as c on s.id=c.id
精彩评论