09-26-2007, 12:44 PM
|
#2 (permalink)
|
|
The Reckoner
Join Date: Sep 2007
Posts: 437
Thanks: 22
|
Hi there, try the following code
PHP Code:
$count = mysql_query(" SELECT COUNT(DISTINCT commensimage.poster) as commensimage_count, COUNT(DISTINCT commentsprofile.poster) as commentsprofile_count, COUNT(DISTINCT commentscafe.poster) as commentscafe_count FROM commensimage, commentsprofile, commentscafe WHERE poster = $poster;") or die(mysql_error());
THis should return 3 seperate counts. If you wanted to add them all together and return the total, you can do something like this:
PHP Code:
SELECT COUNT(DISTINCT commensimage.poster) + COUNT(DISTINCT commentsprofile.poster) + COUNT(DISTINCT commentscafe.poster) as total_count FROM
|
|
|
|