| Line 162... |
Line 162... |
| 162 |
reopen.count reopen_count
|
162 |
reopen.count reopen_count
|
| 163 |
from activity rec
|
163 |
from activity rec
|
| 164 |
left join activity res on (res.ticketId = rec.ticketId and res.type = 'SEND_EMAIL_TO_CUSTOMER' and res.creationTimestamp > rec.creationTimestamp)
|
164 |
left join activity res on (res.ticketId = rec.ticketId and res.type = 'SEND_EMAIL_TO_CUSTOMER' and res.creationTimestamp > rec.creationTimestamp)
|
| 165 |
left join agent ag on (ag.id = res.creatorId)
|
165 |
left join agent ag on (ag.id = res.creatorId)
|
| 166 |
left join ticket t on (t.id = rec.ticketId)
|
166 |
left join ticket t on (t.id = rec.ticketId)
|
| 167 |
left join (select ticketId, count(*) count from activity where ticketStatus = 'REOPEN' group by ticketId) reopen on (reopen.ticketId = rec.ticketId)
|
167 |
left join (select a.ticketId, count(*) count from activity a, activity p where a.ticketStatus = 'REOPEN' and p.id in (select max(i.id) from activity i where i.ticketId = a.ticketId and i.id < a.id) and p.ticketStatus != 'REOPEN' and p.ticketId = a.ticketId group by ticketId) reopen on (reopen.ticketId = rec.ticketId)
|
| 168 |
where (res.type = 'SEND_EMAIL_TO_CUSTOMER' or res.type is null)
|
168 |
where (res.type = 'SEND_EMAIL_TO_CUSTOMER' or res.type is null)
|
| 169 |
and rec.type = 'RECEIVED_EMAIL_FROM_CUSTOMER'
|
169 |
and rec.type = 'RECEIVED_EMAIL_FROM_CUSTOMER'
|
| 170 |
and (res.creationTimestamp = (select min(a.creationTimestamp) from activity a where a.ticketId = rec.ticketId and a.creationTimestamp > rec.creationTimestamp and a.type = 'SEND_EMAIL_TO_CUSTOMER') or res.creationTimestamp is null);</sql>
|
170 |
and (res.creationTimestamp = (select min(a.creationTimestamp) from activity a where a.ticketId = rec.ticketId and a.creationTimestamp > rec.creationTimestamp and a.type = 'SEND_EMAIL_TO_CUSTOMER') or res.creationTimestamp is null);</sql>
|
| 171 |
<limit>0</limit>
|
171 |
<limit>0</limit>
|
| 172 |
<lookup/>
|
172 |
<lookup/>
|