By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

Remove Duplicate in drop down list ASP CLASSIC

P: 1
I retrieved all the records from database, and there are lots of duplicates due to pushing all the records into drop down list.


Expand|Select|Wrap|Line Numbers
  1.     SQL = "SELECT * FROM where calendar_Type= '" &sCalendarType& "' order by date_holiday"
Reason for not using distinct is due to other fields are required from this query.


>2013,2013,2013,2013,..... 2014,2014... 2015,2015,2015...

I want to filter up the record in drop down list to become:


I know it need a condition in between the loop but I can't figure it out.

Please Help. thanks

Below is my code :

Expand|Select|Wrap|Line Numbers
  1.     response.write(" <select name=""year1"">")
  2.     Do While not rs.eof
  3.         nDateHoliday = rs("date_holiday")
  4.         Ndate= year(nDateHoliday)
  5.         response.write("<option value=" & Ndate & ">" & Ndate & "</option>" & vbCrLf)
  6.         rs.MoveNext()
  7.     Loop
  8.     response.write("</select>")
Jun 18 '13 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,370
Please use code tags when posting code.

You said you can't use distinct but I don't see why not. I don't see where you use any of those other fields in your code.
Jun 18 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.