开发者

mysql query with join

开发者 https://www.devze.com 2023-03-27 23:09 出处:网络
this is my database: I would retrieve all records in richiestepreventivo where idImpres开发者_如何学Goa==xx and all the data in privati where privati.id==richiestepreventivo.idPrivato.

this is my database:

mysql query with join

I would retrieve all records in richiestepreventivo where idImpres开发者_如何学Goa==xx and all the data in privati where privati.id==richiestepreventivo.idPrivato. Can you explain me how I have to set the query with join?

Thanks.


SELECT *
FROM privati AS p
INNER JOIN richiestepreventivo AS r
      ON p.id = r.idPrivato
WHERE r.idImpresa = xx

Are you asking for a simple inner join


SELECT r.id, p.data 
FROM richiestepreventivo r 
JOIN privati p ON p.id = r.idPrivato 
WHERE r.id = XX;
0

精彩评论

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