|
nettop -> Joining data from two tables (6/5/2006 14:53:11)
|
I've read through several examples of this but can't get my attempt at joining fields from two tables that have the same ID field to work (Ideally, I would only show the response for the most recent response only). Here are the specifics: I have a table called "issues" that I'm trying to join with a table called "responses" in the following manner to show:
<thead>
<tr>
[color=#FF0000]<<this is a note and NOT in the code, the following two field are from the table 'issues'>>[/color]
<th ALIGN="LEFT"><b>date_submitted</b></th>
<th ALIGN="LEFT"><b>issue_id</b></th>
<th ALIGN="LEFT"><b>issue_name</b></th>
<th ALIGN="LEFT"><b>issue_desc</b></th>
[color=#FF0000]<<this is a note and NOT in the code, the following two field are from the table 'responses'>>[/color]
<th ALIGN="LEFT"><b>Response Date</b></th>
<th ALIGN="LEFT"><b>Response</b></th>
</tr>
</thead>
<tbody>
<!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<% end if %>
<%
fp_sQry="SELECT issues.date_submitted,issue_id,issue_name,issue_desc, responses.date_response,response FROM issues, responses WHERE issues.issue_id=responses.issue_id Order by issue_id Asc"
fp_sDefault="null"
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="issues"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="date_submitted"
fp_sMenuValue="date_submitted"
fp_sColTypes="&issue_id=3&issue_name=202&issue_desc=203&user_id=3&priority_id=3&status_id=3&version=202&approved=17&tested=17&assigned_to=3&assigned_to_orig=3&date_submitted=135&date_resolved=135&date_modified=135&modified_by=3&response_id=3&issue_id=3&response=203&user_id=3&priority_id=3&status_id=3&version=202&approved=17&tested=17&assigned_to=3&date_response=135&"
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<tr>
<td>
<%=FP_FieldVal(fp_rs,"date_submitted")%></td>
<td>
<%=FP_FieldVal(fp_rs,"issue_id")%></td>
<td>
<%=FP_FieldVal(fp_rs,"issue_name")%></td>
<td>
<%=FP_FieldVal(fp_rs,"issue_desc")%></td>
<td>
<%=FP_FieldVal(fp_rs,"date_response")%></td>
<td>
<%=FP_FieldVal(fp_rs,"response")%></td>
</tr>
<!--#include file="../_fpclass/fpdbrgn2.inc"--> Thanks for your help, Tim
|
|
|
|