Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
i have the following problem:
I one table i have two fields: Name, Location
In another table i have location information in a hierarchy structure. Lets take the following two tables as an example:
Users:
Name | Location |
---|---|
Smith | 1 |
Johnson | 2 |
Locations:
ID | Name | ParentLocation |
---|---|---|
0 | AMERICAS | |
1 | US | 0 |
2 | NA East | 1 |
3 | NA West | 1 |
What i want, is to add to the Users table the location information, so it looks like this:
Users:
Name | Location1 | Location2 | Location3 |
---|---|---|---|
Smith | AMERICAS | US | not set |
Johnson | AMERICAS | US | NA East |
How can i do this ?
Thanks for some help.
K
For example, you can do it the following way:
Locations:
Hierarchy (NodeID, ParentID, Location, ParentLocation, Location, Path, '/', Depth)
Load Autonumber(ID,'NodeID') as NodeID, Name as Location, Autonumber(ParentLocation,'NodeID') as ParentID inline
[ID, Name, ParentLocation
0, AMERICAS,
1, US, 0
2, NA East, 1
3, NA West, 1];
People:
Load Autonumber(Location,'NodeID') as NodeID, Name inline
[Name, Location
Smith, 1
Johnson, 2];
HIC