I am trying to build a sql query for an exam site and need to list the top scoring exams for a user, there can be multiple exams.
I have the following script in ASP that puts the results into a javascript function so they can be read by a cms system on another server.
this returns one result per exam for the user but it is the first one in the database for the exam and user.
i only need to return the ID and UserID from the database.
Any help would be appreciated
I have the following script in ASP that puts the results into a javascript function so they can be read by a cms system on another server.
Code:
rs.Source = "select ID, Username, UserID, Test_Name, MAX(Grade) FROM testscores WHERE UserID = " & Session("sesUserID") & " AND Grade > 69 GROUP BY UserID,Test_Name ORDER BY CAST(Grade AS UNSIGNED)"
Response.write("moduleCertificates: function(){")
response.write(vbcrlf)
response.write ("return {")
rs.Open()
while not rs.eof
Dim testName_Short
Dim testName
testName = rs.Fields.Item("test_Name").Value
testName_Short = testName
testName_Short = replace(testName_Short, "Gold_", "")
testName_Short = replace(testName_Short, "Silver_", "")
testName_Short = replace(testName_Short, "Bronze_", "")
response.write("'" & testName_Short & "': ' https://testwww.sharpacademy.eu/certificate.swf?UID=" & rs.Fields.Item("UserID").Value &"&ID=" & rs.Fields.Item("ID").Value & "',")
response.write(vbcrlf)
rs.MoveNext
Wend
response.write ("};")
response.write(vbcrlf)
response.write ("}")
response.write(vbcrlf)
rs.Close
Set rs = Nothing
i only need to return the ID and UserID from the database.
Any help would be appreciated
Comment