jasonc Posted August 26, 2009 Share Posted August 26, 2009 i wish to get the total of posts from each member from the following database table CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL auto_increment, `submittedby` text NOT NULL, KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=786726 ; i wish to have the results show the members name and the total posts. how is this done please. Link to comment https://forums.phpfreaks.com/topic/171943-count-all-member-posts-for-each-member/ Share on other sites More sharing options...
asmith Posted August 26, 2009 Share Posted August 26, 2009 I assume the id field is referring to another table and the id means id post of that table? table2 = the table which contains the posts table1 = this table you showed us SELECT t2.*, count(t1.submittedby) s numberOfPosts from TABLE2 as t2 INNER JOIN table1 as t1 ON t2.id = t1.id GROUP BY t1.submittedby Link to comment https://forums.phpfreaks.com/topic/171943-count-all-member-posts-for-each-member/#findComment-906632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.