Elan Ruusamäe <[EMAIL PROTECTED]> [25-05-2007 16:23]: [...] > mysql> select a.category_id,count(*) from album a where exists (select > album_id from image where album_id=a.id) group by 1; > Empty set (0.00 sec)
This query makes little sense and is not ANSI SQL compliant (category_id not used in aggregate statement or GROUP BY), so both behaviours are incorrect -- it should return an error. If you want to count the number of albums in a given category which have images, that would be the proper query (exists vs join: depending on the amount of data): select a.category_id, count(*) from album a join image i on i.album_id=a.id group by a.category_id; </offtopic> -- Radosław Zieliński <[EMAIL PROTECTED]>
pgpbLqpTvhX7B.pgp
Description: PGP signature
_______________________________________________ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en