SQL Join query

From: Date: Sat, 07 Aug 2004 09:27:14 +0000
Subject: SQL Join query
Groups: php.general 
Request: Send a blank email to php-general+get-193072@lists.php.net to get a copy of this message
I have a problem with my mysql query SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics, pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id GROUP BY pic_comments.pic_id; pics table: | id | submitter | time | date | category | pic_comments table: | pic_id | comment | The problem is that i only get the the pictures that have comments, i want even the pictures where there arent no comments and the field num_comments should be 0. Someone who have an idea to solve this? _________________________________________________________________ Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/

« previous php.general (#193072) next »