Hi, On Mon, 9 Aug 2004 18:12:42 +0000, in php.general you wrote:
>* Thus wrote Jonathan Haddad: >> The only problem there is when you group the LEFT JOIN pictures that >> have a count of 0 return a count of 1. Unfortunately there's no single >> query that I figured out when I did this same project that would give >> accurate results. > >SELECT > pics.*, > pic_comments.*, > count(*) + if(pic_comments.pic_id = NULL, -1, 0) Or simply: SELECT pics.*, pic_comments.*, count(pic_comments.pic_id) .. COUNT() does not count fields with NULL when specifying a specific field (as opposed to just count(*) ) .. but this is rather an SQL-related question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php