If you have

Customer1  Item #1
Customer1  Item #2
Customer1  ....
Customer2  Item #1
Customer2  Item #2
Customer2  ....

then you can use the GROUP attribute of cfoutput, make sure you have
oreder by customer in your SQL and ....

<cfouput query="foo" group="customer">
    #foo.customer#
     <cfoutput>
            #item#
      </cfoutput>
      <br />
</cfoutput>

something like that.

Doug

----- Original Message -----
From: Andy Ousterhout <[EMAIL PROTECTED]>
Date: Fri, 1 Oct 2004 10:52:28 -0500
Subject: SQL Question: Using query to generate report columns
To: CF-Talk <[EMAIL PROTECTED]>

I need to create a report that shows Customers in columns and items purchased
in rows.  To simplify this discussion, assume that there are two tables:

PurchasedItems
     Customer
     Item #
     Qty
Items
     Item #
     Name

Is there a way to create a report that would look like this:

Customer Name 1   Item #1  Item #2    Item #3 ...
Customer Name 2  Item #1  Item #2    Item #3 ...
....

It is easy to create one that looks like this:

Customer1  Item #1
Customer1  Item #2
Customer1  ....
Customer2  Item #1
Customer2  Item #2
Customer2  ....

Customer Name    Item #1
...

Andy________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to