Hi Everyone.

Can someone help me out with the following problem.
I have a table in my SQL DB called categories.
In it there are 3 fields: CategoryID, LnkCategoryID, CategoryTitle
What I am trying to do is the following:

When LnkCategoryID = 0 that means that that record is a Main Category.
So in my table there are 3 main categories right now:

CategoryID = 1
LnkCategoryID = 0
CategoryTitle = Hardware 

CategoryID = 2
LnkCategoryID = 0
CategoryTitle = Software

CategoryID = 3
LnkCategoryID = 0
CategoryTitle = Software

Each Main Category can have subcategories and you can probably see that the
LnkCategoryID becomes the CategoryID from the main categories.

CategoryID = 4
LnkCategoryID = 1
CategoryTitle = Hard Drives

CategoryID = 5
LnkCategoryID = 1
CategoryTitle = CD Rom Drives

CategoryID = 6
LnkCategoryID = 1
CategoryTitle = Floppy Drives

etc...etc..

Well I am trying to output the Main Category with the lnked categories below
them such as:

Hardware
-Hard Drives
-CD Rom Drives
-Floppy Drives

Software
-Web Editors
-Graphics
-Operating Systems

etc..

How can I write the SQL Statement for this and use it with cfloop or cfquery
to get my desired results.

My apologies for the long post, I tried for awhile to get it on my own, I
thought I would ask now.

Thanks to anyone who can help. I am a novie SQL user/writer.


Michael T. Tangorre

======================
Alfred University
Webteam Manager 
AIM: CrazyFlash4
Phone: 607-426-9277
======================
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to