Small problem with relational tables and displaying the correct titles.
Here's my problem.

I have two tables in an access database (yes I know!). One called
district_plan_documents, the other district_plan_section_headings. In
the documents table there is a field called DP_catID (where 5 entries
have a 1, 10 have a 2 and so on). In the district_plan_section_headings
table there are the same fields with the relevant titles i.e. DP_catID
is 1 and DP_Heading for this is "District Plan Text", DP_catID is 2 and
DP_Heading for this is "District Planning Maps" and so on.

So I tried the following:

<cfquery name="getDistrictPlanDocs" datasource="#request.dsn#">
  SELECT        * 
  FROM  district_plan_documents
  ORDER BY      DP_catID, Line_Order
</cfquery> 
 
<cfquery name="getDistrictPlanHeadings" datasource="#request.dsn#">
  SELECT        * 
  FROM  district_plan_section_headings
  ORDER BY      DP_catID
</cfquery>

And in my display:

<cfoutput query="getDistrictPlanDocs" group="DP_catID">
<cfif getDistrictPlanDocs.DP_catID EQ getDistrictPlanHeadings.DP_catID>
#getDistrictPlanHeadings.DP_Heading#
</cfif>
<ul>
<cfoutput>
    <li style="padding-bottom: 10px">
    <a
href="#httpdir##docpath#/#Document_name#">#Document_name#</a></li>
</cfoutput>
</ul>
</cfoutput>

This doesn't work, because it's only showing the FIRST heading (for
DP_catID of 1).

It can probably be done in the SQL but I'm no SQL expert (obviously).
Basically, all I want are the proper headings for the heading table that
match the DP_catID from the documents table. Any ideas here?? 

TIA
Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224140
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to