Hi, Using 3.1, self-s. I wonder if anybody can put me on the right track?
Here's a table with some example data. Each row is linked to a 'parent' row, in tree fashion.
ID ...... ParentID
1 ...... 1
2 ...... 2
3 ...... 2
4 ...... 2
5 ...... 3
6 ...... 1
7 ...... 1
8 ...... 3
9 ...... 2
10...... 2
----------- Wanted results ------------
ID
1
6
7
2
3
4
I want to produce an efficient query that (among other things) can return x amount of rows from each level (with various sorts)..
In this case the first 3 from 'level 1', 2 from 'level 2'
Those parameters are variable - it may require 10 from level 1, first 3 from each of the next levels.
Cheers,
Frank.