3 Replies - 2259 Views - Last Post: 02 January 2010 - 10:01 AM Rate Topic: -----

#1 RedWombat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-December 09

Grouping, Counting, Totally Query Output

Posted 28 December 2009 - 03:49 PM

Good day everyone. I'm hoping someone can point me in the right direction. I've been using Coldfusion for awhile, although I admit, I'm not a master at it.

I'm pulling my hair out on a project I'm hoping someone can shed some light on.

I have a table in my database that I want to group and output a report on.

It's a table tracking purchases and types of purchases.

Here's the data I'm collecting: from_name, from_company, transaction_type, and amount. I have a few other fields, but they aren't needed for this report. There are multiple transactions per person and a varying number of persons.

What I need to do is to create queries that will group by name or company, which doesn't matter, give me a count of transaction types (3 of A, 6 of B, etc.) as well as a total amount of each type, then show the total transactions count by name or company and the total amount.

I'm trying to output in a table having each row be the data from each company.

Can someone point me in the right direction to group such output, do counts on the number of records as well as show totals dollars?

Thank you so much for any advice you might have.

Is This A Good Question/Topic? 0
  • +

Replies To: Grouping, Counting, Totally Query Output

#2 xheartonfire43x  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 454
  • Joined: 22-December 08

Re: Grouping, Counting, Totally Query Output

Posted 29 December 2009 - 02:19 PM

View PostRedWombat, on 28 Dec, 2009 - 02:49 PM, said:

Good day everyone. I'm hoping someone can point me in the right direction. I've been using Coldfusion for awhile, although I admit, I'm not a master at it.

I'm pulling my hair out on a project I'm hoping someone can shed some light on.

I have a table in my database that I want to group and output a report on.

It's a table tracking purchases and types of purchases.

Here's the data I'm collecting: from_name, from_company, transaction_type, and amount. I have a few other fields, but they aren't needed for this report. There are multiple transactions per person and a varying number of persons.

What I need to do is to create queries that will group by name or company, which doesn't matter, give me a count of transaction types (3 of A, 6 of B, etc.) as well as a total amount of each type, then show the total transactions count by name or company and the total amount.

I'm trying to output in a table having each row be the data from each company.

Can someone point me in the right direction to group such output, do counts on the number of records as well as show totals dollars?

Thank you so much for any advice you might have.


The way I normally approach a problem like this is to organize what I need to do into sections. First off divide into the sections of the table you are creating: body, footer.
Within the those 2 sections there are more sections
body:
-line body
-line footer
footer is one part.

Within the line body you have the details and within the line footer you have the counts for that line.

Now that you have that planned out it might be best to download and install ColdFusion Report Builder and build your report like that. It is a very simple program to use and can export reports to HTML, PDF, Excel, RTF, etc.
Was This Post Helpful? 0
  • +
  • -

#3 psykoprogrammer  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 72
  • Joined: 09-October 06

Re: Grouping, Counting, Totally Query Output

Posted 30 December 2009 - 04:18 PM

I've got a blog post with a sample explanation of using grouping in a CFOUTPUT loop. The blog entry can be seen here at http://blog.adampres...-in-coldfusion/, and a sample of it running at http://coldfusioncod...y.com/grouping/.

Hope that helps a bit.
Was This Post Helpful? 0
  • +
  • -

#4 RedWombat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-December 09

Re: Grouping, Counting, Totally Query Output

Posted 02 January 2010 - 10:01 AM

Thanks Guys!

I'll give it shot. I'll look through your blog post as well Adam.

I'll post back how it went so others can learn.

Carl
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1