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 Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/131030-count-multiple-tables/#findComment-681697 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.