MySQL Forums
Forum List  »  Newbie

Re: complex mysql query
Posted by: Peter Brawley
Date: April 17, 2022 11:44AM

Is this what you mean?

SELECT s.nom, count(c.id) as contracts_number, sum(c.montant) * m.numbre as total
FROM societees AS s
JOIN contrats AS c ON s.id = c.societes_id
JOIN contracts_machines m ON c.id = m.contracts_id
GROUP BY s.nom;

If not, please say how not, and post the Show Create Table result for each of the tables.

Options: ReplyQuote


Subject
Written By
Posted
April 16, 2022 10:08PM
Re: complex mysql query
April 17, 2022 11:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.