| 
	
 | 
 Posted by Hendri Kurniawan on 02/08/07 06:45 
Jan Morten Sørensen wrote: 
> Hi All! 
>  
> I am trying to put up a menusystem and need some tips on how to approach 
> this... 
>  
>  
 
 
1. SELECT all parents 
 
SELECT 
	Category.id, Category.name 
FROM Category JOIN Category_relationships ON Category.id =  
Category_relationship.id 
WHERE Category_relationsip.parentid = 0; 
 
2. For each parent, do a select again, this time with parentid = the id 
 
 
Just a suggestion, your db structure can be optimized in some ways. 
 
Hendri Kurniawan
 
  
Navigation:
[Reply to this message] 
 |