How to join two tables mysql?

2019-01-01 04:23发布

I have two tables:

services

  • id
  • client
  • service

and

clients

  • id
  • name
  • email

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

4条回答
梦醉为红颜
2楼-- · 2019-01-01 04:32
SELECT * FROM table1 LEFT JOIN table2 on table1.id = table2.id
查看更多
听够珍惜
3楼-- · 2019-01-01 04:51
SELECT ...
FROM services AS s
INNER JOIN clients AS c
  ON s.client=c.id
查看更多
千与千寻千般痛.
4楼-- · 2019-01-01 04:52
SELECT ...
FROM services AS s
JOIN clients AS c
  ON s.client = c.id
WHERE ...
查看更多
高级女魔头
5楼-- · 2019-01-01 04:56

Try this,

SELECT * from services as s INNER JOIN clients as c on s.id=c.id 
查看更多
登录 后发表回答