[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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

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

Reply via email to