G
Guest
Can any SQL expert figure this one out
I have a table with 4 columns: ID, Area, Keyword and Parent
The ID is an autonumber primary key and the Parent points to other ID's in the same table
The top=level keywords have a parent of NULL
Thus this table stores hierarchies of keywords
Now the complication, certain Keyword hierarchies are restricted to certain Areas oin which case Area is non-Null. Are is filled in onlt for the top level keywords i.e. Keywords with parent of Null
Now my problem is to list all Keywords where the top level keyword has a certain Area
Here is an exampl
ID Area Keyword Paren
1 USA Ca
2 USA Truc
3 China Ricksha
4 Buick
5 Dodge
6 Electric
7 Pedaled
8 Ram
9 12V
If Area is set to USA, it should return ID's 1,2,4,5,
If Area is set to China, it should return ID's 3,6,7,9
I have a table with 4 columns: ID, Area, Keyword and Parent
The ID is an autonumber primary key and the Parent points to other ID's in the same table
The top=level keywords have a parent of NULL
Thus this table stores hierarchies of keywords
Now the complication, certain Keyword hierarchies are restricted to certain Areas oin which case Area is non-Null. Are is filled in onlt for the top level keywords i.e. Keywords with parent of Null
Now my problem is to list all Keywords where the top level keyword has a certain Area
Here is an exampl
ID Area Keyword Paren
1 USA Ca
2 USA Truc
3 China Ricksha
4 Buick
5 Dodge
6 Electric
7 Pedaled
8 Ram
9 12V
If Area is set to USA, it should return ID's 1,2,4,5,
If Area is set to China, it should return ID's 3,6,7,9