Yes, rearange your data:

 categoryId       pcategoryId     category       
 1        1       Water  
 2        1       Ozone  
 3        1       Ultra Pure     
 4        4       Cleaning       
 5        4       Kitchen        
 6        4       Bathroom       

And write select category from category order by pcategoryID, categoryId

Regards,
Henner

> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im 
> Auftrag von Lazaro Fung
> Gesendet: Freitag, 28. Februar 2003 23:57
> An: [EMAIL PROTECTED]
> Betreff: [dbforms] Hierarchical Output in combo box
> 
> 
> Hi. 
>   
> I have this table in MySQL 
>   
> CREATE TABLE `category` ( 
>   `categoryId` int(4) NOT NULL auto_increment, 
>   `pcategoryId` int(4) NOT NULL default '0', 
>   `category` varchar(50) NOT NULL default '', 
>   PRIMARY KEY  (`categoryId`) 
> ) TYPE=MyISAM 
>   
> to represent a hierarchical category 
>   
> categoryId       pcategoryId     category       
> 1        0       Water  
> 2        1       Ozone  
> 3        1       Ultra Pure     
> 4        0       Cleaning       
> 5        4       Kitchen        
> 6        4       Bathroom       
>   
> I need need to set a categoryId to a product in the table 
>   
> CREATE TABLE `product` ( 
>   `productId` int(4) NOT NULL auto_increment, 
>   `product` varchar(200) NOT NULL default '', 
>   `description` text, 
>   `categoryId` int(4) NOT NULL default '0', 
>   PRIMARY KEY  (`productId`) 
> ) TYPE=MyISAM 
>   
> I need to setup a combo with all the categories but ordered as : 
>   
> Water 
>     Ozono 
>     Ultra Pure 
> Cleaning 
>     Kitchen 
>     Bathroom 
>   
> Note: the category table not are in this order. 
>   
> Any ideas ? 
>   
> Sincerely 
>   
> LFung 
>                                
> 
> 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to