in reply to Counting rows from table1 while querying table2
If the table "posts" has a field called "catid" such that many rows may have the same value in this field, and if the table "categories" also has a field called "catid" such that each catid value occurs in exactly one row, then you might be looking an sql statement like this:
But I'm just guessing, based on the fact that you say you want to "determine how many 'posts' were found..." If that doesn't work for you, you should consult a good resource for teaching SQL. Posting sql syntax questions to PerlMonks is okay if you do it in the Chatterbox. As a SoPW node, it's "off-topic".select id, catname, catdesc, count(p.catid) from categories c, posts p where p.catid = c.catid group by p.catid
|
|---|