I'm trying to join two views "A" and "B" using the op:join-left-outer
function.
I have two "ON-conditions" for the JOIN:
- The first one is a simple
op:on
function. (And not a part of my problem) - The second one should be an ON-condition joining a column by value (
$myValue
). Butop:on
does not support values, only column-references. So the following code doesn't work:
let $aView := op:from-view("foobar", "A")
let $bView := op:from-view("foobar", "B")
let $myValue := "42"
let $opticQuery := op:join-left-outer(
$aView,
$bView,
(
op:on(op:view-col("A", "SOME_COLUMN"), op:view-col("B", "SOME_COLUMN")),
(: Not working pseudo code following :)
op:on(op:view-col("B", "SOME_OTHER_COLUMN"), $myValue)
)
)
In SQL I would write something like this:
SELECT * FROM A
LEFT JOIN B
ON A.SOME_COLUMN = B.SOME_COLUMN
AND B.SOME_OTHER_COLUMN = '42'
My question: Is there a way to do the same in Optic API or am I doing something wrong?