Nicodemas
04-30-2003, 06:53 AM
Does Access support DISTINCT SQL calls?
I am having a tissy about this one statement in my code, in that it is not pulling only the distinct, individual last name, first name combinations.
<%
strSQL = "SELECT DISTINCT ID, Rank, LName, FName FROM tblPOC"
ysnSuccess = adlExecuteSQL (strDB, strSQL, RSPeople)
Do Until RSPeople.EOF
Response.Write("<option value=" & RSPeople("ID") & ">" & RSPeople("Rank") & " " & RSPeople("LName") & ", " & RSPeople("FName"))
RSPeople.movenext
Loop
RSPeople.Close
Set RSPeople = Nothing
%>
Is it my ID field that is screwing it up? The ID field is a primary key, and therefore distinct... but I've never used distinct until now so I have no idea how that works.
I am having a tissy about this one statement in my code, in that it is not pulling only the distinct, individual last name, first name combinations.
<%
strSQL = "SELECT DISTINCT ID, Rank, LName, FName FROM tblPOC"
ysnSuccess = adlExecuteSQL (strDB, strSQL, RSPeople)
Do Until RSPeople.EOF
Response.Write("<option value=" & RSPeople("ID") & ">" & RSPeople("Rank") & " " & RSPeople("LName") & ", " & RSPeople("FName"))
RSPeople.movenext
Loop
RSPeople.Close
Set RSPeople = Nothing
%>
Is it my ID field that is screwing it up? The ID field is a primary key, and therefore distinct... but I've never used distinct until now so I have no idea how that works.