我需要创建一个DB2查询来从maximo中为重新打开的票证提取票证报告

时间:2013-11-02 09:28:38

标签: sql db2 maximo

我需要找出一个月内重新开票的总票数。我尝试了一个查询,但它仅为当前打开的票证提供结果,即(实际完成不为空)和(状态不在('已解决','已关闭))

其他搜索条件可以是状态的更改,但我不知道查询以比较状态的更改。

任何打开状态的更改都应该大于第一个已解决的状态。

请帮忙。迫切需要它。

1 个答案:

答案 0 :(得分:0)

Plz尝试此查询,您获得了所有重新打开的票证。

select ticketid from incident where ticketid in ( 

select b.ticketid from
(select distinct ticketid, min(changedate) x from tkstATUS WHERE orgid='IMCT' and status='RESOLVED' group by ticketid) a
inner join
(select distinct ticketid, max(changedate) y from tkstATUS WHERE orgid='IMCT' and status in ('INPROG') group by ticketid ) b
on a.ticketid=b.ticketid
where a.x < b.y)

与你