Hi, here's the problem.
The table structure would be something similar to:
[tt]tierX
-------
IDtierX (primary key, auto_increment)
IDoverX (unique)
name (not null)[/tt]
Say the data in the table is:
[tt] IDtierX | IDoverX | name
-----------+-----------+---------
1 | 2 | one
2 | 3 | two
3 | 4 | three
4 | 5 | four
5 | | five
6 | 7 | six
7 | 8 | seven
8 | | eight[/tt]
I have IDtierX and want to get all the names in a sequence where a sequence starts with IDtierX and ends where IDoverX=''.
So with the table above, if I know IDtierX = 1, I want a query that'll give me the names 'one, two, three, four, five'. If I know IDtierX = 6, I want the same query to give me the names 'six, seven, eight'.
The sequence length is variable.
Of course this could be done through multiple queries and say php, but that wouldn't be too efficient over the long run.
I'm using postgresql.
So, any suggestions? Alternate table setups are welcome as well.
Thanks, JB
The table structure would be something similar to:
[tt]tierX
-------
IDtierX (primary key, auto_increment)
IDoverX (unique)
name (not null)[/tt]
Say the data in the table is:
[tt] IDtierX | IDoverX | name
-----------+-----------+---------
1 | 2 | one
2 | 3 | two
3 | 4 | three
4 | 5 | four
5 | | five
6 | 7 | six
7 | 8 | seven
8 | | eight[/tt]
I have IDtierX and want to get all the names in a sequence where a sequence starts with IDtierX and ends where IDoverX=''.
So with the table above, if I know IDtierX = 1, I want a query that'll give me the names 'one, two, three, four, five'. If I know IDtierX = 6, I want the same query to give me the names 'six, seven, eight'.
The sequence length is variable.
Of course this could be done through multiple queries and say php, but that wouldn't be too efficient over the long run.
I'm using postgresql.
So, any suggestions? Alternate table setups are welcome as well.
Thanks, JB