Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query Parent and child table values at a time #279

Open
ghost opened this issue Jul 24, 2021 · 0 comments
Open

query Parent and child table values at a time #279

ghost opened this issue Jul 24, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 24, 2021

Dialect

MySQL

Failing SQL

SELECT *,
(SELECT COUNT(tableb.tableA_id) FROM TableB WHERE TableB.tableA_id = tablea.id) AS count
FROM TableA tablea;

Description

I have a Parent table and child table with foreign key association. i need to query parent table along with count of each id in child table.

Screenshot 2021-07-25 at 12 26 32 AM

@ghost ghost added the bug label Jul 24, 2021
@veyndan veyndan added the mysql label Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant