У меня есть две таблицы Athena со следующими запросами:
select
date,
uid,
logged_hrs,
extract(hour from start_time) as hour
from schema.table1
where building = 'MKE'
and pt_date between date '2019-01-01' and date '2019-01-09'
и
select
associate_uid as uid,
date(substr(fcdate_utc, 1, 10)) as pt_date,
learning_curve_level
from tenure.learningcurve
where warehouse_id = 'MKE'
and date(substr(fcdate_utc, 1, 10)) between date '2019-01-01' and date '2019-01-09'
Я хочу присоединиться к ним на uid
и pt_date
. Как я могу это сделать?
Я пытался:
select (select
date,
uid,
logged_hrs,
extract(hour from start_time) as hour
from schema.table1
where building = 'MKE'
and pt_date between date '2019-01-01' and date '2019-01-09') as a
left join (select
associate_uid as uid,
date(substr(fcdate_utc, 1, 10)) as pt_date,
learning_curve_level
from tenure.learningcurve
where warehouse_id = 'MKE'
and date(substr(fcdate_utc, 1, 10)) between date '2019-01-01' and date '2019-01-09'
) as b
on a.uid=b.uid and a.pt_date = b.pt_date
Но приведенное выше приводит к ошибке mismatched input 'left' expecting {<eof>, ',', 'from', 'where', 'group', 'order', 'having', 'limit', 'union', 'except', 'intersect'}