I don't think this is a perl question, and anyway, you haven't quite given the right info to get the right answer. But I'll try guessing at an answer anyway...
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:
select id, catname, catdesc, count(p.catid)
from categories c, posts p
where p.catid = c.catid
group by p.catid
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".
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.