i want to get an average duration on each node an process
i tried
select e.name_, a.name_, avg(distinct b.duration_ ) from jbpm_node a, jbpm_log b, jbpm_processinstance d, jbpm_processdefinition e, jbpm_token t where d.processdefinition_ = e.id_ and a.id_ = b.SOURCENODE_ and d.ROOTTOKEN_ = t.ID_ and t.NODE_ = a.ID_ group by e.name_, a.name_ order by 3 desc;