Ahh if only there was a way to do that I would be so happy.

Tyler Clendenin
GSL Solutions 

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 06, 2003 6:35 AM
To: CF-Talk
Subject: Re: SQL: Brain Teaser

[EMAIL PROTECTED] wrote:
> 
> USERS TABLE
> -----------------
> USER_ID
> USERNAME
> etc...
> 
> COMMENTS TABLE
> -------------------------
> COMMENT_ID
> USER_ID
> COMMENT
> etc...
> 
> I know I can query USERS and then loop through the results fetching 
> the comments... but I'd rather not do that.  Here's the results I'm 
> trying to get... in a SINGLE query if possible:
> 
> USER_ID,USERNAME,MERGED_COMMENTS
> 1,joe,comment1<br>comment2<br>comment3
> 2,sam,comment
> 3,sue,comment<br>another comment<br>etc.

Use a custom aggregate function. PostgreSQL example:
http://www.zope.org/Members/pupq/pg_in_aggregates

Jochem




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to