Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputing the averaging a column of numbers in a table 1

Status
Not open for further replies.

dennis1000

Programmer
Nov 30, 2002
7
US
I am attempting to average a column of mumbers in a table. Did a search of threads that poroduced no results. I found the SQL statement in Que's text but cannot find any info on how to output it on a page. The data source is called ratepay, the table is called ratepay, access db is called rate and the table field is called Salary. Here's my start:

<CFQUERY NAME=&quot;GetAveSalary&quot; DATASOURCE=&quot;ratepay&quot;>
SELECT AVG (Salary)
FROM ratepay
WHERE 0=0
</CFQUERY>

<html><body>


<CFOUTPUT Query=&quot;GetAveSalary&quot;>
#Salary#
</CFOUTPUT>
</body></html>

What am I doing wrong? Thanks for your help in advance.
 
Try:
<CFQUERY NAME=&quot;GetAveSalary&quot; DATASOURCE=&quot;ratepay&quot;>
SELECT AVG (Salary) as newSal
FROM ratepay
WHERE 0=0
</CFQUERY>

<html><body>


<CFOUTPUT Query=&quot;GetAveSalary&quot;>
#newSal#

</CFOUTPUT>
</body></html>
DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top