I have a SQL situation for which I don’t have a solution.
Combinations of locations are defined in table PressureBox in which DD and CR are both Foreign Keys to the Location table.
Table Location
+--------+--------+
| ID | Name |
+--------+--------+
| KPN1 | AA |
| MIN2 | BB |
| KGM10 | CC |
| KST100 | DD |
+--------+--------+
Table PressureBox
+--------+--------+
| DD | CR |
+--------+--------+
| KPN1 | KGM10 |
| MIN2 | KST100 |
+--------+--------+
I’m trying to get the following resultset:
+-------+-------+
| Loc1 | Loc2 |
+-------+-------+
| AA | BB |
| CC | DD |
+-------+-------+
(from table Location, Name aliased as Loc1/Loc2)
So for example, KPN1 + KGM10 must result in “AA | CC”.
How can this be accomplished in SQL? Any ideas, solutions or hints are welcome. Thanks.
1 Answer