Krisi almost had it... this will do the trick. 

<cfquery name="category_person" ...>
        select id, category, person
        from theTable
        order by category, person
</cfquery>

<cfoutput query="category_person" group="category">
        #Category#<br>
        <cfoutput group="Person">
                - #Person#<br>          
        </cfoutput>
</cfoutput>

The other suggestion is going to produce bunch of un-necessary queries.

-----Original Message-----
From: Kory Bakken [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 12:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [KCFusion] query output (OT)


Sorry, you need to make sure that the qry_categories specifies a DISTINCT category.
-----Original Message-----
From: Kory Bakken 
Sent: Friday, March 28, 2003 12:56 PM
To: [EMAIL PROTECTED]
Subject: RE: [KCFusion] query output (OT)


Try this...

<cfquery datasource="dsn" name="qry_categories">
    SELECT Category
    FROM    Table
    WHERE    ...
</cfquery>
<cfset listCategories = QuotedValueList(qry_categories.Category)>
<cfloop list="listCategories" index="i">
<cfoutput>    
#i#<br>
</cfoutput>
        <cfquery  datasource="dsn" name="qry_people">
        SELECT    Person
        FROM    Table
        WHERE    Category = #i#
        </cfquery>
        <cfoutput query="qry_people">
        #qry_people.Person#
        </cfoutput>
</cfloop>
-----Original Message-----
From: Adaryl Wakefield [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 11:57 AM
To: [EMAIL PROTECTED]
Subject: [KCFusion] query output (OT)


Is this even possible? I need to display data from a query thusly:
Category1
Person1
Person2
Person3
Category2
Person1
Person2
Person3
I used the group attribute of the output tag but that only spit out 1 record.
Without the group attribute I get
Category1
Person1
Category1
Person2
...
Which is what I expect, just not what I need.
A.


______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/[EMAIL PROTECTED]
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]

Reply via email to