Another SQL Question
| From: | Barry Prentiss | Date: | Fri, 10 Aug 2001 23:07:20 +0000 |
| Subject: | Another SQL Question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11240@lists.php.net to get a copy of this message | ||
Hi,
I am writing a FAQ machine in PHP using Oracle 8.1.6.
I can't figure out what's not working in my SQL query.
I've spent two days on the Oracle site, to no avail.
I have three tables:
FAQ[ID,QUESTION,ANSWER]
FAQ_CAT[FAQ_ID,CAT_ID]
CAT[ID,NAME] (category)
I'm trying to list CAT.ID, CAT.NAME and count(*) where count(*) is the
count of all FAQs in each category.
My latest attempt looks something like this:
select c.id, c.name, a.num from cat c,(select count(*) num from faq_cat f
where f.cat_id = c.id) a;
I keep getting an 'invalid column name' at the last 'c.id'...
Any suggestions?
Thx in Advance,
Barry Prentiss