Dear Group
I wonder whether you can push me in a direction on how to design the
following statement. I'm looking for a SELECT with some tricky ORDER
BY.
The database table looks like this:
MenuID TabText SubTabID TabOrderID
------- ----------- ----------- -----------
1 Main 0 1
2 Cars 0 2
3 Boats 0 3
4 Planes 0 4
5 Pick-Ups 2 1
6 Campers 2 2
The result should look like this:
Main
Cars
Pick-Ups
Campers
Boats
Planes
Notice that 'Pick-Ups' and 'Campers' are a subcategory of 'Cars' and
must appear in the result directly following 'Cars'.
In more detail:
'Main', 'Cars', 'Boats' and 'Planes' are top-level categories and
'Pick-Ups' and 'Campers' are subcategories of 'Cars'. The SubTabID
value of an item identifies to what top-level category a subcategory
belongs.
The TabOrderID specifies in what order the items should be sorted,
e.g. 'Pick-Ups' comes first and 'Campers' second.
Thanks very much for your help & efforts!
Martin