I want to apply a column to a list of users where I pull the latest sign in date . Traditionally I would do something like this:
SELECT U.* , O.* FROM Users.Users U
OUTER APPLY ( SELECT .. FROM .. Events.Events E WHERE E.UserId = U.UserId) O
However BigQuery doesn't seem to recognize the Outer Apply keywords. What Am I doing wrong, is there a substitute for above?
This approach seems to work:
Of course, in your simplified case, you don't actually need
OUTER APPLY
(or standard SQLLEFT JOIN LATERAL
). You'd just use an ordinaryLEFT JOIN
. I'm assuming your outer applied derived table does something more fancy that requires this operator.