James,
You've run into one of the ugly truths of CF development: good database
design can make for more complicated cfcode. From your description,
however, I think that you shouldn't have too much trouble with this.
You can use the group="" feature of CFOutput to take care of this problem.
Here's a quick and dirty example:
<cfoutput query="getCategoryInfo" group="CatID">
#CatName# - <cfoutput>#CatSubCatOf#,</cfoutput><br>
</cfoutput>
That should give you:
Shoes - sports,loafers,dress,dance,
Shirts - dress,t-shirts,
Pants - chinos,cords,jeans,
You'll note that you're getting an extra comma at the end of the subcat
list. That can be a problem but there are always workarounds.
hth,
Kevin
At 10:29 AM 4/25/00 -0500, you wrote:
> This is really more of a SQL question rather than a Cold Fusion
>question... but...I am working on a project where I have 2 tables set up to
>hold information. The reason why I use 2 tables is because for every record
>in table A there could be 1 or many records in table B. So, my problem is
>when I do a query, and more than one record exists in table B, my query
>returns more than one record. I need the query to return just one record,
>but with the all the information from table B in a format that I could use
>it. Say, a comma delimited list.
>
>Here is the code I'm using for the query now:
>
><cfquery name="getCategoryInfo" datasource="#ds#" dbtype="ODBC">
> SELECT RT_Category.CatID, RT_Category.CatIsValid,
>RT_Category.CatName, RT_Category.CatDesc, RT_Category.CatTemplateName,
>RT_Category.CatHeader, RT_Category.CatFooter, RT_Category_Context.CatID,
>RT_Category_Context.CatSubCatOf
> FROM RT_Category, RT_Category_Context
> WHERE RT_Category.CatId = RT_Category_Context.CatID
></cfquery>
>
>Any help anyone could provide would be most appriciated.
>
>Thanks.
>James.
--------------------------
Kevin Marshall
Web Application Developer
eCalton.com, Inc.
Vero Beach, FL
www.ecalton.com
[EMAIL PROTECTED]
561.569.4500
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.