Solved

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

Posted on 2004-08-12
6
269 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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