MySQL Forums
Forum List  »  General

Re: Joining multiple tables
Posted by: Dash-Ulziit Oddelger
Date: March 02, 2020 04:21AM

I have even tried
"SELECT `client_company`.`company_name`, COUNT(IF(`client_contact`.`company_id` = `client_company`.`id`, 1, NULL)) AS Contacts, COUNT(IF(`license`.`company_id` = `client_company`.`id`, 1, NULL)) AS Licenses FROM `client_company`, `client_contact`, `license` GROUP BY `client_company`.`id`"

but still multiplying the previous COUNT by the second COUNT. and the second count is also multiplying by itself.

Options: ReplyQuote

Written By
Re: Joining multiple tables
March 02, 2020 04:21AM

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.