I have a System_PDF table and a System table. The System_PDF table allows more than one entry to be associated with the System table with the join being on the System.System_ID and System_PDF.SystemID.
My problem is when I show a list of records from the System table - any record with more than one associated record in the System_PDF table is duplicated in the list.
I have the tables joined so that if any record in the System table that has a missing field in an associated table can be highlighted
I’ve spent a long time tying to figure this out how I make it so I only get one entry in the list?
Can anyone help?
Below is the code with the highlighted areas:
My problem is when I show a list of records from the System table - any record with more than one associated record in the System_PDF table is duplicated in the list.
I have the tables joined so that if any record in the System table that has a missing field in an associated table can be highlighted
I’ve spent a long time tying to figure this out how I make it so I only get one entry in the list?
Can anyone help?
Below is the code with the highlighted areas:
Code:
<%
sql = "SELECT * FROM Business " & _
"LEFT JOIN [Business_Logos] ON Business.LogoID = [Business_Logos].Logo_ID " & _
"INNER JOIN System ON Business.Business_Id = System.BusinessID AND [UnitID] = '1' " & _
[COLOR=red]"LEFT JOIN System_PDF ON System_PDF.SystemID = System.System_ID " & _[/color]
"LEFT JOIN System_Terms ON System_Terms.SystemID = System.System_ID " & _
"ORDER BY [System Code] ASC;"
Set rs = obj_CN.Execute(sql, adBoolean)
While Not rs.EOF
s_logo = rs("Logo_ID")
s_code = rs("System Code")
Response.Write "<a href=""records.asp?id=" & server.UrlEncode(s_code) & """"
if trim(rs("System Code")) = "" or _
trim(rs("System Description")) = "" or _
isnull(rs("BusinessID")) or _
isnull(rs("Installment System")) or _
isnull(rs("Terms Text")) or _
[COLOR=red]isnull(rs("PDF_ID")) or _[/color]
isnull(rs("CoverID")) then
Response.Write "class=""highlight"""
end if
Response.Write ">" & "<img src=""display.asp?id=" & s_logo & """ border=""0"">" & " " & rs("System Code") & "</a>" & "|" & vbTab & "<br />"
rs.MoveNext
Wend
%>