Stefan Motz
asked on
Select Distinct Year from Date
I would like to do a select distinct in a dropdown menu from a date field, but return only the Year, not the full date. The attached code returns all dates once, but I'd like returned only the year.
Thanks for your help.
Thanks for your help.
<%
sql="SELECT distinct(OccDate) FROM Compliments"
Set rsYears = conn.Execute(sql)
%>
<select name="myYear">
<option></option>
<%
Do While Not rsYears.EOF
Response.Write "<option>"& rsYears("OccDate") &"</option>"
rsYears.MoveNext
Loop
Response.Write "</select>"
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER