![DevelTec's picture DevelTec's picture](https://www.cmcrossroads.com/sites/default/themes/techwell/images/user_icon_default.jpg)
This SQL query did the trick:
select distinct T1.dbid,T1.id,T4.name,T1.headline,T1.resolution,T40.resolution
from
(
(
( escalation T1 INNER JOIN statedef T4 ON T1.state = T4.id )
LEFT OUTER JOIN parent_child_links T40mm ON T1.dbid = T40mm.parent_dbid and 16783175 = T40mm.parent_fielddef_id
) LEFT OUTER JOIN codestreams T40 ON T40mm.child_dbid = T40.dbid
)
where T1.dbid <> 0 and
(((T40.resolution not in('Fixed') or T40.resolution is not NULL) and T4.name = 'Closed'))
and T1.id not in (
select distinct T1.id
from
(
(
( escalation T1 INNER JOIN statedef T4 ON T1.state = T4.id )
LEFT OUTER JOIN parent_child_links T40mm ON T1.dbid = T40mm.parent_dbid and 16783175 = T40mm.parent_fielddef_id
) LEFT OUTER JOIN codestreams T40 ON T40mm.child_dbid = T40.dbid
)
where T1.dbid <> 0 and
(((T40.resolution in('Fixed')) and T4.name = 'Closed'))) order by T1.id desc