Is there a way to get a DISTINCT row and a count of the columns in one Recordset? Such as:
strSQL = "SELECT DISTINCT Inspections, COUNT(*) FROM Mills WHERE PartNum = '" & Request.Form("PartNum"
& "' GROUP BY Inspections"
?? It executes fine, but the script keeps timing out. I'm trying to loop through another record set that holds all the part info (called Rs), and in each loop iteration, loop though this record set (called Rs_Distinct) to determine if there's more then one Inspection number for each part number, and if there is, just display it once.
At the top of the page I have the following code, which works just fine:
Do While Not Rs_Distinct.EOF
If Rs_Distinct(1) > 1 Then
Response.Write("Assembly #" & Rs_Distinct(0) & " has multiple records."
End If
Rs_Distinct.MoveNext()
Loop
After that code I move to the begining of Rs_Distinct and continue on...
Then I have bPrint, and in each iteration of Rs (Do While Not Rs.EOF), I loop through Rs_Distinct, and if Rs(1) > 1, I set bPrint = False and do Rs_Distinct.MoveLast(), otherwise bPrint stays True and I move to the next record in Rs_Distinct.
So I guess I'm asking if anyone happens to know why the script is timing out? Any help is much appreciated!! Darrell Mozingo
strSQL = "SELECT DISTINCT Inspections, COUNT(*) FROM Mills WHERE PartNum = '" & Request.Form("PartNum"
?? It executes fine, but the script keeps timing out. I'm trying to loop through another record set that holds all the part info (called Rs), and in each loop iteration, loop though this record set (called Rs_Distinct) to determine if there's more then one Inspection number for each part number, and if there is, just display it once.
At the top of the page I have the following code, which works just fine:
Do While Not Rs_Distinct.EOF
If Rs_Distinct(1) > 1 Then
Response.Write("Assembly #" & Rs_Distinct(0) & " has multiple records."
End If
Rs_Distinct.MoveNext()
Loop
After that code I move to the begining of Rs_Distinct and continue on...
Then I have bPrint, and in each iteration of Rs (Do While Not Rs.EOF), I loop through Rs_Distinct, and if Rs(1) > 1, I set bPrint = False and do Rs_Distinct.MoveLast(), otherwise bPrint stays True and I move to the next record in Rs_Distinct.
So I guess I'm asking if anyone happens to know why the script is timing out? Any help is much appreciated!! Darrell Mozingo