I am asking for help with a query that involves 2 tables:
[tt]tblPaths tblCost
PathID Node1 Node2 Node3 ... Node12 Node1st Node2nd Cost
1 24 19 38 ... 18 1 2 10
2 33 5 93 ... 87 1 3 8
3 80 12 62 ... 71 1 4 27
... 1 5 3
100,000+ ....
100 98 15
100 99 62[/tt]
In tblPath, there are many records, each showing 12 numbered nodes that can be any value from 1 to 100.
In tblCost, we see the 'Cost' of moving from one node to the next. For example, moving from node1 to node5 has a 'cost' of 3 (units are arbitrary).
Here's what I need the query to do. For each PathID, I need the TOTAL Cost. For example, when PathID = 3, the Total Cost = the cost of moving from (80 to 12) + the cost of moving from (12 to 62) + ... etc to 71.
I'm having a rough time getting this to work properly. Because I need to do this process for a number of very large tables, I'm really looking for efficiency.
Many thanks
Vicky
[tt]tblPaths tblCost
PathID Node1 Node2 Node3 ... Node12 Node1st Node2nd Cost
1 24 19 38 ... 18 1 2 10
2 33 5 93 ... 87 1 3 8
3 80 12 62 ... 71 1 4 27
... 1 5 3
100,000+ ....
100 98 15
100 99 62[/tt]
In tblPath, there are many records, each showing 12 numbered nodes that can be any value from 1 to 100.
In tblCost, we see the 'Cost' of moving from one node to the next. For example, moving from node1 to node5 has a 'cost' of 3 (units are arbitrary).
Here's what I need the query to do. For each PathID, I need the TOTAL Cost. For example, when PathID = 3, the Total Cost = the cost of moving from (80 to 12) + the cost of moving from (12 to 62) + ... etc to 71.
I'm having a rough time getting this to work properly. Because I need to do this process for a number of very large tables, I'm really looking for efficiency.
Many thanks
Vicky