So I have the following query:
'SELECT *, upload.id AS id, report.id AS report_id, (SELECT COUNT(*)
FROM upload WHERE report.upload_id = upload.id) AS nums FROM upload
LEFT JOIN report ON upload.id=report.upload_id WHERE private="0" '
I am having an issue with how the reports for each upload are being counted. This query needs to count all the reports for a given upload, and return all the uploads when fetched. For some reason every time that a new report is inserted instead of being added to the total count I get a duplicate upload. See the image below:

Notice how console (1).png shows up three times for each report that correlates to the given upload…really I want it to show up once and then the count on the side should be ( 3 ). Any help would be much appreciated!!
SQL Fiddle for testing.
Just use a left join and count the
report.upload_idsI left out
where private = "0", since you didn’t specify where it belongs to.