id | itemId | correlationId |
---|---|---|
1 | A | |
2 | B | A |
3 | A | |
4 | C | B |
5 | D | B |
6 | E | D |
Hello, I have a Notes database with a similar structure like the table above. This table contains a unique id for each document. It also contains an itemId, which is not unique, and a correlationId which creates a relation to another item (itemId). I want to select all documents, which have a specific itemId (in this example A) and every document which is correlated to this itemId (directly or indirectly). The result should look similar to my table. I was wondering if I need to write multiple requests or if it is possible to write only one formula.
SELECT @Contains(itemId; "A");
SELECT @Contains(correlationId;"A")
=> retrieve itemId: B ==>SELECT @Contains(correlationId;"B")
=> retrieve itemId: C, D ==> SELECT @Contains(correlationId;"C")
(no result) and SELECT @Contains(correlationId;"D")