The Little Guy Posted November 1, 2008 Share Posted November 1, 2008 Why doesn't this give the proper count? SELECT COUNT( users.id ) AS 'userCount', COUNT( images.id ) AS 'imgCount' FROM images, users Link to comment https://forums.phpfreaks.com/topic/131030-count-multiple-tables/ Share on other sites More sharing options...
fenway Posted November 3, 2008 Share Posted November 3, 2008 Because you have no join condition, amongst other things. Link to comment https://forums.phpfreaks.com/topic/131030-count-multiple-tables/#findComment-681448 Share on other sites More sharing options...
Barand Posted November 4, 2008 Share Posted November 4, 2008 And, even if you have a join condition, if there are multiple records in one table matching multiple records in the the other then you get a multiplying effect on the counts. Link to comment https://forums.phpfreaks.com/topic/131030-count-multiple-tables/#findComment-681697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.