Raditha Dissanayake wrote:

> try postgres instead http://www.postgresql.org/

It's the most helpful comment I've seen for a long time.
You know, it won't work in Postgre too probably. If you like Postgre - 
use it and don't force others to use it (for wrong reasons nevertheless).
Everyone should pick his/her own tools...

Anyway, instead of writing this:

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;

Write this:

SELECT pics.*, pic_comments.*, count(*) AS num_comments 
FROM pics
LEFT JOIN pic_comments ON (pic_comments.pic_id = pics.id)
WHERE pics.category = 1
GROUP BY pics.pic_id;

Lenar

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to