I have the following lateral join that I am trying to migrate to Snowflake from Postgres
select *
from service f
join lateral
(select s.*
from inferred s
where s.patient = f.patient
order by s.from_date desc
limit 1
) s
on 1=1
limit 23
I am getting the following error in Snowflake -
SQL execution internal error: Processing aborted due to error 300010:1094633624; incident 5081153.
There are patients in the service table and the inferred
table. The query tries to join patients from the service table with the latest record of the same patient from the inferred
table.