I am building a few new tables to store some articles and notes on our
website. I want it structured so that it displays:

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.

So right now I have a total of 3 Headers, I have multiple Sub Headings
that can be under one header and multiple titles under each heading.

So the output should look like:

Application Notes
  General Application Notes
  Title 1
  Title 2
  Title 3

Amplifier Application Notes
Title 1
Title 2
Title 3

Articles
Featured Articles
Title 1
Title 2
Title 3

But right now I am getting:

Application Notes
General Application Notes
Title 1
Application Notes
Title 2

Am I totally losing it and not designing the DB right? I have built way
more complex databases than this but yet I'm struggling to see my
mistake here.

Thanks,
Ben
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to