groupby and joins on the same table
Posted: Wed Apr 13, 2005 5:30 am
a little trouble getting the sql right.
here is my table with some sample data.
the results that I would like to get would be
sub_id is the id that the row belongs to as a sub group
I getting to confused with the joins inner, outer, left and the various combinations.
Thanks
Jcart | Added
here is my table with some sample data.
Code: Select all
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 londonsub_id is the id that the row belongs to as a sub group
Code: Select all
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 electronicThanks
Jcart | Added
Code: Select all
tags[/size][/color]