Ben Densmore said:
>
> Top Level Header
>  Sub Heading
>   Title of Article
>
> I built 3 separate tables:
>  One has just an ID and a Header field
>  The second has an ID and the Sub Heading
>  The third table has an ID, the Header Foreign Key and the
> SubHeading
> Foreign key and then the title and where the file is stored.
>
> The problem I'm having is when I do my query:
> <cfquery name="getHeadings" datasource="test">
> Select appNotesHeaders.*,AppHeadings.*,appNotes.*
> from appNotesHeaders,AppHeadings,appNotes
> where
> AppNotes.HeaderFK = appNotesHeaders.appNotesHeadersID
> And
> AppNotes.HeadingFK = AppHeadings.App_Heading_ID
> </cfquery>
>
> It displays my Headers and Sub Headings more than once if there is
> more than one article in a given Header.

> Am I totally losing it and not designing the DB right?

You could put the top level and sub level headings in one table, but
for the current design your DB schema is fine.

What you should do is group your output:
<cfoutput query="..." group="...">
  Heading
  <cfoutput group="...">
    Subheading
    <cfoutput>
      Article
    </cfoutput>
  </cfoutput>
</cfoutput>

Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to