I'm using Stream Analytics' T-SQL to do a full outer join of a stream input and a reference data input.
I've tried the following query but I keep getting an error saying "When joining stream and reference data, reference data must be on the right side".
I want to do a full outer join of the two - how do I do this if the reference data could never be on the left side?
With leftJoin AS (
SELECT SA.[InputID], RD.[InputID]
FROM StreamData AS SA
LEFT JOIN ReferenceData AS RD
ON SA.[InputID] = RD.[InputID]
),
rightJoin AS (
SELECT SA.[InputID], RD.[InputID]
FROM ReferenceData AS RD -- Causes the error 'cause it should be on the right
LEFT JOIN StreamData AS SA
ON SA.[InputID] = RD.[InputID]
)
SELECT *
INTO [StorageTable]
FROM leftJoin
UNION
SELECT *
FROM rightJoin
My expected output is something like this:
SA.[InputID] | RD.[InputID]
------------------------------
1 | 1
2 | null
null | 3
4 | 4