开发者

How to join two tables mysql?

I have two tables:

开发者_如何学C

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


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 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜