Solved

How to read an output of the group by query in cold fusion.

Posted on 2004-08-12
6
250 Views
Last Modified: 2013-12-24
I am developing a report in cold fusion with ms access database.
and I want to run a query through a cold fusion page .
My query is
select source,count(id) from table_name group by source.
I don't know how to read the output of this query in cold fusion.

0
Comment
Question by:gaby22
  • 3
  • 3
6 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 11786877
<cfquery datasource="yourdsn" name="access_query">
SELECT Source, COUNT(ID) AS SourceCount FROM table_name GROUP BY Source
</cfquery>

<cfoutput query="access_query">
#Source# --> #SourceCount#<br>
</cfoutput>
0
 
LVL 4

Accepted Solution

by:
eclipse2k earned 500 total points
ID: 11786906
i guess, your problem is to get the count??? you should be able to give a name to the count variable.


Example 1)
select source,count(id) As 'sourcecount' from table_name group by source

Example 2)
select source,count(id) As sourcecount from table_name group by source


the only difference between example 1 and 2 is the ' around sourcecount, i am working with microsoft sql and there are both allowed, not sure with access, you should try it.


CF:

<cfoutput query="myquery">
 Source: #Source#, Occurance: #sourcecount# times
</cfoutput>



eclipse2k
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 11786930
hello mrichmon, just faster again..? i need more training.. :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 35

Expert Comment

by:mrichmon
ID: 11787200
:o)

Happens all the time that two people post the same thing at almost the same time
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 11793952
hello mrichmon,

i dont understand why finally i got the accepted answer? sorry mrichmon...
you should be the one.

now i finally qualifed for the premium services for beeing one of the experts :) 10k points, finally :)

oh, i guest i should stop chit chatting in the Question Threads. Sorry, was the last one. Probaby :)
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11794568
no problem - I don't care abou the points just about the user getting the answer.
Glad you got the premium services  :o)
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now