Hi,

I'm trying to code online product catalog using coldfusion and SQL Server
2000. When the customer comes to the website, first he selects his cars
manufacturer, model and type to get uniq Car_ID number. Then simple SQL query
checks which products will be availible for the specific car using
Products-table. But instead of outputting all the products to the customer he
first has to choose a group. So using the products_to_groups table a simple sql
query checks what child groups to show to customer.

This is how far I've managed to come. Now I need a recursive script that
queries every child-groups parent-groups and outputs them to customers as
cftreeitems using groups-table.

The script should look following:
- get all products that fit to specific car using products table
- get products groups using products_to_groups -table (groups depth can be 1,
2, 3 or 4)
- output groups as cftreeitems
- loop until Parent_ID = NULL
- get groups parent-groups using groups-table
- output parent-groups as cftreeitems
- end loop

The structure of tables is following:

CREATE TABLE Products (
Article_Number int NOT NULL IDENTITY(100, 1),
Car_ID int )

CREATE TABLE Products_to_groups (
Article_Number int NOT NULL IDENTITY(100, 1),
Node_ID int )

CREATE TABLE Groups (
Node_ID int NOT NULL IDENTITY(100, 1),
Parent_ID int,
Depth int,
Name varchar(255) )

Thanks for the help,
Roni