Look up the count() SQL function On 4/17/07, Ian Vaughan <[EMAIL PROTECTED]> wrote: > > Hi > > I have a documents table and a categories table, each record in the > documents table is assigned a category from the categories table > (documents.sub_cat = categories.catno) > > What query would I use to count the number of documents within each > category > > i.e. > > Category 1 (25 Records) > > Category 2 (35 Records) > > This is my query that brings back the category names from the database > at present > > <CFQUERY name="query" datasource="datasource"> > SELECT catno, category, cat_desc, parent_level > from categories > where parent_level =#URL.catno# > </CFQUERY> > > > Any ideas would be most welcome > > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275569 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

