id sub_id name link
1 0 Home home
2 0 Contact contact
3 0 Services services
4 3 DB design db design
5 3 Graphic Design graphic design
6 5 Paper paper
7 5 Electronic electronic
8 2 birmingham offices b'ham
9 2 london offices london
the results that I would like to get would be
sub_id is the id that the row belongs to as a sub group
id sub_id name link
1 0 Home home
2 0 Contact contact
8 2 birmingham offices b'ham
9 2 london offices london
3 0 Services services
4 3 DB design db design
5 3 Graphic Design graphic design
6 5 Paper paper
7 5 Electronic electronic
I getting to confused with the joins inner, outer, left and the various combinations.
Sorry I tried to do the old copy paste thing but it didn't turn out quite right.
I have a table called menu_items in it there are 4 columns
id sub_id name link
all main menu items will have an id ie.home or services.
some of the main menu items will have sub catagories such as services might have db design and graphic design as seperate further links. so db design might have an id of 5 but its sub_id would be 2 because that is what services id is.
I'm i making this as clear as mud.
one table to create collapasable menu items for my page. actually it is to try and stuff it into a current cms that doesn't currently support the creation of collapsable menus