recordset filtering from another recordset
okay, here is my problem in a nut shell
i have a search page to display results based on a zip code location(lat/long) coordinates. The first recordset on the page shows the builder information that is within the search parameters:
<%
Dim builder_ID__longValue
builder_ID__longValue = "1"
If (Request.Querystring("long") <> "") Then
builder_ID__longValue = Request.Querystring("long")
End If
%>
<%
Dim builder_ID
Dim builder_ID_cmd
Dim builder_ID_numRows
Set builder_ID_cmd = Server.CreateObject ("ADODB.Command")
builder_ID_cmd.ActiveConnection = MM_home_detective_STRING
builder_ID_cmd.CommandText = "SELECT builder_info_ID, ( 3959 * acos( cos( radians(39.8227054) ) * cos( radians(builder_info.lat ) ) * cos( radians(builder_info.lng) - radians(?)) + sin(radians(39.8227054)) * sin( radians(builder_info.lat)))) AS distance FROM home_detective.builder_info HAVING distance < 75 ORDER BY distance"
builder_ID_cmd.Prepared = true
builder_ID_cmd.Parameters.Append builder_ID_cmd.CreateParameter("param1", 5, 1, -1, builder_ID__longValue) ' adDouble
Set builder_ID = builder_ID_cmd.Execute
builder_ID_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
builder_ID_numRows = builder_ID_numRows + Repeat1__numRows
%>
Then from here i have another table that has the builder_ID value listed with all of the school districts that they work within.
What i want to do is to display the search results for the School district *** BUT NOT DISPLAY THE DUPLICATED VALUES *** here is the code i am using
<%
While ((Repeat1__numRows <> 0) AND (NOT builder_ID.EOF))
%>
<%
Dim school_district__MMColParam
school_district__MMColParam = "1"
If (builder_ID.fields.item("builder_info_ID") <> "") Then
school_district__MMColParam = builder_ID.fields.item("builder_info_ID")
End If
%>
<%
Dim school_district
Dim school_district_cmd
Dim school_district_numRows
Set school_district_cmd = Server.CreateObject ("ADODB.Command")
school_district_cmd.ActiveConnection = MM_home_detective_STRING
school_district_cmd.CommandText = "SELECT DISTINCT school_district FROM home_detective.school_district WHERE builder_ID = ?"
school_district_cmd.Prepared = true
school_district_cmd.Parameters.Append school_district_cmd.CreateParameter("param1", 5, 1, -1, school_district__MMColParam) ' adDouble
Set school_district = school_district_cmd.Execute
school_district_numRows = 0
%>
<div><%=(builder_ID.Fields.Item("builder_info_ID").Value)%>
<%=(school_district.Fields.Item("school_district").Value)%>
</div>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
builder_ID.MoveNext()
Wend
%>
as you can see, it displays the results but if 2 builders have the same school district, it displays that school district twice. I only want the DISTINCT values
any ideas?
