Re: Oracle 8.1.6 SQL Question

From: Thrasher, Kendall & Assoc. <thrasherkendall_at_mediaone.net>
Date: Mon, 20 Aug 2001 18:31:18 GMT
Message-ID: <3b86572c.736034451_at_192.168.192.30>


Barry,

Not a tuned solution, but a functional one would be:

select c.id, c.name, count(fc.faq_id) "Occurences" from faq_cat fc, category c
where fc.cat_id = c.id
group by c.id, c.name

On Fri, 10 Aug 2001 15:17:05 -0700, "Barry Prentiss" <thebear_at_antispam.stanford.edu> wrote:

>I am trying to query an oracle database via PHP and am stumped on the
>following SQL query:
>I am building a FAQ machine and have tables and fields as follows:
>
>FAQ (table)
> ID
> QUESTION
> ANSWER
>
>CATEGORY (table)
> ID
> NAME
>
>FAQ_CAT (table)
> FAQ_ID
> CAT_ID
>
>I want to list all categories with ID, NAME and COUNT
>(where count is the number of occurances of each category in the FAQ_CAT
>table i.e. the number of FAQs in each category).
> I have spent two days on the Oracle site trying every poorly documented
>gyration I could find, but haven't solved the problem yet...
> What am I doing wrong?
> Thx in Advance,
> Barry Prentiss
>
>
Received on Mon Aug 20 2001 - 20:31:18 CEST

Original text of this message