Hi all,

Here's s sql stumper, well, not really.  But I haven't been able to
figure out the best way to do it yet so I'm posting here.  I know it's
sql but it does have CF implications.

Scenario: I have a table called CATEGORY with the following columns

ID PK for table
PARENT_ID If populated it's the ID of this category's parent
NAME Name of category
DESCRIPTION Description of category
ACTIVE_IND Active indicator (1 | 0)
DATE_ADDED Date category added to db
DATE_UPDATED Date category was last updated

The goal is to create a view that will go through every single category and
determine the tree structure used to navigate to that category.  This table can
be used for menus, directory structures, or any other app that needs the
ability to store data in a hierarchical structure.

The drawback of this table design is that when a user selects a particular
category from the table and you want to show them where this category
is in relation to it's parent(s) categories you have to jump through a lot of
cfif's.  The ideal solution is to have a view that determines all of these
relationships and you just run a query on that view by passing in the
category you want info on and your query returns the exact hierarchical
structure of the category relative to the category you selected.

Here's an example:
You have the following categories.
Fruits
Apples
Washington Red Apples
Fiji
Golden Delicious
Pears
Peaches
Veggies
Meats

When someone clicks on a link representing the "Washington Red Apples"
category we should automatically create a navigational crumb trail with this,
Fruits > Apples > Washington Red Apples and make each one of the parents
of "Washington Red Apples" clickable.  This means we'll need to return their
category id in our query as well.

Anyone have experience in doing such a thing?

Thanks,
Jason

Application Engineering Services
Information Management Florida Operations
Telephone: 321.799.6845
Fax: 321.799.5970
e-mail:[EMAIL PROTECTED]

The  comments and opinions expressed are my own and do not represent the view of United Space Alliance.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to