MySQL Forums
Forum List  »  General

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

I have DONE IT!!!!

SELECT `company_name`, `address`, `phone_number`, (SELECT COUNT(*) FROM `client_contact` WHERE `client_company`.`id` = `client_contact`.`company_id`) as `contacts`, (SELECT COUNT(*) FROM `license` WHERE `client_company`.`id` = `license`.`company_id`) as `licenses` FROM `client_company` ORDER BY `id` DESC

I just wrote another SELECT inside a bracket which I did not know was possible. Gonna write it here IF any people need it.

Options: ReplyQuote

Written By
Re: Joining multiple tables
March 02, 2020 07:26AM

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.