Remove Duplicate in drop down list ASP CLASSIC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pinhoong
    New Member
    • Jun 2013
    • 1

    Remove Duplicate in drop down list ASP CLASSIC

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

    Code:

    Code:
        SQL = "SELECT * FROM insite.holiday where calendar_Type= '" &sCalendarType& "' order by date_holiday"
    Reason for not using distinct is due to other fields are required from this query.

    Before:

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

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

    >2013,2014,20 15

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

    Please Help. thanks

    Below is my code :

    Code:
        response.write(" <select name=""year1"">")
        Do While not rs.eof
            nDateHoliday = rs("date_holiday")
            Ndate= year(nDateHoliday)
            response.write("<option value=" & Ndate & ">" & Ndate & "</option>" & vbCrLf)
            rs.MoveNext()
        Loop
        response.write("</select>")
    Last edited by Rabbit; Jun 18 '13, 05:33 AM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    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.

    Comment

    Working...