I need to build a dataset that only shows created events that aren't associated with a reschedule event, because the way the system that generates my data works is that for every time a Rescheduled event occurs a Created event is generated. Both of these events have the same date and timestamp.
This code only shows the Created and Rescheduled events:
select *
from wingmanapr2016 a
left join (select a.action_date from Atable a where exists (select event_name from Btable b where b.event_name = 'Created') and a.event_name = 'Rescheduled') b on b.action_date = a.action_date
where a.event_name not in ('Allocated', 'Available', 'completed', 'Edited')
order by a.action_date, a.account_number
If someone could give an answer ASAP it would be greatly appreciated
Aucun commentaire:
Enregistrer un commentaire