Open leandrosardi opened 4 hours ago
select x.id_job, l.create_time, l.first_name, l.last_name, l.job_title
from "lead" l
join "event" e on (l.id=e.id_lead and e.create_time > current_timestamp - interval '12 hour')
join event_job x on e.id=x.id_event
where l.first_name like 'Steve'
and l.last_name like 'Gast%'
select j.id, s.name, j.done_time, j.status, count(x.id_event) as total_events, count(distinct x.id_event) as unique_events
from "job" j
join "source" s on s.id=j.id_source
left join event_job x on j.id=x.id_job
where j.done_time > current_timestamp - interval '12 hour'
group by j.id, s.name, j.create_time, j.done_time, j.status
order by j.create_time desc
select l.create_time, l.first_name, l.last_name, l.job_title
from event_job x
join "event" e on e.id=x.id_event
join "lead" l on l.id=e.id_lead
where x.id_job='1b09b048-3b12-4ac0-a253-d99fcfec00ad'
order by l.create_time desc