Hi all,
I'm trying to find a way that list DISTINCT Year(date) from a database simpliest.
Here is how I came up:
Is there a way to make it less messy?
Thanks!
I'm trying to find a way that list DISTINCT Year(date) from a database simpliest.
Here is how I came up:
Code:
'Get Years for Monthly Report
sql = "SELECT DateTime FROM tblTechSupports ORDER BY DateTime"
set rs = objConn.Execute(sql)
x = ""
if not rs.eof then
arrYears = rs.GetRows()
end if
If isArray(arrYears) Then
For i=0 to ubound(arrYears,2)
if Year(arrYears(0,i)) <> x then
x = Year(arrYears(0,i))
response.write arrYears(0,i) & "<BR>"
end if
Next
End If
Is there a way to make it less messy?
Thanks!