Results 1 to 3 of 3

Thread: Problem with Select

  1. #1
    Join Date
    Jan 2003
    Posts
    2

    Question Problem with Select

    Hi!

    I am trying to fill a combo box from an Access base, the code below is working:


    <form method="POST" action="show_salary.asp">
    Seller<br>
    <select name="seller">
    <option selected>Choose!</option>



    <%
    Set Connect = Server.CreateObject("ADODB.Connection")
    Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=C:\Inetpub\wwwroot\test\Bas 1.mdb"
    Set RecSet = Server.CreateObject("ADODB.Recordset")
    Visa = "SELECT Seller, ID FROM Contract2000 Order By ID"
    RecSet.Open Visa, Connect, adOpenStatic

    While NOT RecSet.EOF
    %>
    <option value="<%=RecSet("Seller")%>"><%=RecSet("Seller")% ></option>
    <%
    RecSet.MoveNext
    WEND
    %>
    </select>
    <%
    Set RecSet = NOTHING
    Connect.Close
    %>

    The problem I have is that in the table, Seller, the same name are showing more than 1 time.

    How can I do to make it showing only one time in the combo box??

    Peter

  2. #2
    Join Date
    Dec 2002
    Posts
    181
    Peter,

    SELECT distinct Seller, max(ID)
    FROM Contract2000
    group by Seller
    order by max(ID)


    Jeff

  3. #3
    Join Date
    Jan 2003
    Posts
    2
    Thanks JBane, I will try that

    Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •