I have two tables, users
and reports
. Each user has no, one, or multiple reports associated with it, and the reports
table has a user_id
field.
I have the following query, and I need to add to each row a count of how many reports the user has:
SELECT *
FROM users
LIMIT 1, 10
Do I need to use a subquery, and if so, how can I use it efficently? The reports
table has thousands and thousands of rows.