Hi,

        I hava a table "tblA" that has two fields (id, description) and a table
"tblB" with two fields (fk_tblA, dtInsert). My problem is that i need to
count records in tblB grouping them by (id, description) to know how many
children each record from tblA has in tblB. The sql i'm using is:
"SELECT COUNT(*), id, description FROM tblA, tblB WHERE id=fk_tblA GROUP BY
id, description ORDER BY description"
But if a tblA record doesn't have children in tblB, i wanna it be shown as
"0" Zero

Something like...
COUNT(*)        |       id      |       description
--------------------------------------------------
13              |       1       | first value
0               |       2       | empty list
126             |       3       | something else

and so on...

Any ideas?


Thank u very much,
Dirso.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to