我在统计学生对教师的评价。我希望我的结果显示为:
Instructor1 - 145
Instructor2 - 23
Instructor3 - 394#CountInstructor#未更改。只有第一次计数是正确的。
使用Coldfusion 8。
谢谢你的帮助。
<CFQUERY NAME="GetAll" datasource="eval" dbtype="ODBC">
SELECT ID, Instructor, Q1, Q2, Q3, Q4, Q5, Q6
FROM data
</CFQUERY>
<CFQUERY NAME="GetInstructor" datasource="eval" dbtype="ODBC">
SELECT DISTINCT Instructor
FROM data
ORDER BY Instructor
</CFQUERY>
<cfset myInstructor = ValueList(GetInstructor.Instructor)>
<cfset myCountInstructor = ValueList(GetAll.Instructor)>
<cfset CountInstructor = ListValueCount(myCountInstructor, myInstructor)>
<cfoutput query="GetAll">
<cfset CountInstructor = ListValueCount(myCountInstructor, GetInstructor.Instructor)>
#GetInstructor.Instructor# - #CountInstructor# <br />
</cfoutput>发布于 2013-09-27 01:24:20
在查询输出循环中使用ListValueCount()对您没有任何帮助。你到底想做什么?如果你想做的就是输出一个计数...
<cfoutput query="GetInstructor">
#GetInstructor.Instructor# - #GetInstructor.CurrentRow#
</cfoutput>否则,我不确定您想要做什么(并且您需要确定所有变量的作用域,包括查询名称)。
发布于 2013-10-18 21:56:57
<cfoutput query="GetInstructor">
<cfset CountInstructor = ListValueCount(myCountInstructor, GetInstructor.Instructor)>
#GetInstructor.Instructor# - #CountInstructor# <br />
</cfoutput>https://stackoverflow.com/questions/19033627
复制相似问题