<% lvl=validate(0) if showlastdays>0 then condition=" AND requestdate>='" & getlogin(dateadd("d",now,-showlastdays))&"'" psql="SELECT xlaALSUsers.userid, xlaALSUsers.name, Avg(xlaALSRequests.rating) AS avgrating, Count(xlaALSRequests.requestid) AS totalrequests FROM xlaALSUsers INNER JOIN xlaALSRequests ON xlaALSUsers.userid = xlaALSRequests.userid WHERE xlaALSRequests.rating>0 "&condition&" GROUP BY xlaALSUsers.userid, xlaALSUsers.name ORDER BY Avg(xlaALSRequests.rating) DESC, Count(xlaALSRequests.requestid) DESC" set conn=server.createobject("ADODB.Connection") conn.open connection response.buffer=true response.flush %> Absolute Live Support : Average Rating per Representative <% set rs=conn.execute(psql) c=0 do until rs.eof c=c+1 avgrating=formatnumber(rs("avgrating"),2) totalrequests=rs("totalrequests") stars="" for x=1 to int(avgrating) stars=stars & "" next name=rs("name") userid=rs("userid") %> <% rs.movenext loop rs.close set rs=nothing conn.close set conn=nothing %>
<%=c%>)  <%=name%> <%=stars%> <%=avgrating%>  on <%=totalrequests%> Requests