Subversion Repositories SmartDukaan

Rev

Rev 4170 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4170 Rev 5417
Line 159... Line 159...
159
    <sql>select datediff(rec.creationTimestamp, &apos;20101231&apos;) as date_id, ag.name, rec.ticketId, IFNULL(res.ticketStatus, rec.ticketStatus) status, IFNULL(res.ticketPriority, rec.ticketPriority) priority, rec.ticketCategory category, 
159
    <sql>select datediff(rec.creationTimestamp, &apos;20101231&apos;) as date_id, ag.name, rec.ticketId, IFNULL(res.ticketStatus, rec.ticketStatus) status, IFNULL(res.ticketPriority, rec.ticketPriority) priority, rec.ticketCategory category, 
160
hour(timediff(IFNULL(res.creationTimestamp, now()), rec.creationTimestamp)) response_hours,
160
hour(timediff(IFNULL(res.creationTimestamp, now()), rec.creationTimestamp)) response_hours,
161
datediff(IFNULL(t.closeDate, now()), t.openDate) ticket_close_days,
161
datediff(IFNULL(t.closeDate, now()), t.openDate) ticket_close_days,
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 = &apos;SEND_EMAIL_TO_CUSTOMER&apos; and res.creationTimestamp &gt; rec.creationTimestamp)  
164
left join activity res on (res.ticketId = rec.ticketId and (res.type = &apos;SEND_EMAIL_TO_CUSTOMER&apos; or res.type = &apos;CALLED_CUSTOMER&apos; or res.type = &apos;ESCALATE_TICKET&apos;) and res.creationTimestamp &gt; rec.creationTimestamp)  
165
left join agent ag on (ag.id = res.creatorId) 
165
inner join agent ag on (ag.id = res.creatorId)
166
left join ticket t on (t.id = rec.ticketId)
166
inner join ticket t on (t.id = rec.ticketId)
167
left join (select a.ticketId, count(*) count from activity a, activity p where a.ticketStatus = &apos;REOPEN&apos; and p.id in (select max(i.id) from activity i where i.ticketId = a.ticketId and i.id &lt; a.id)  and p.ticketStatus != &apos;REOPEN&apos; and p.ticketId = a.ticketId 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 = &apos;REOPEN&apos; and p.id in (select max(i.id) from activity i where i.ticketId = a.ticketId and i.id &lt; a.id)  and p.ticketStatus != &apos;REOPEN&apos; and p.ticketId = a.ticketId group by a.ticketId) reopen on (reopen.ticketId = rec.ticketId)
168
where (res.type = &apos;SEND_EMAIL_TO_CUSTOMER&apos; or res.type is null) 
168
where (res.type = &apos;SEND_EMAIL_TO_CUSTOMER&apos; or res.type = &apos;CALLED_CUSTOMER&apos; or res.type = &apos;ESCALATE_TICKET&apos; or res.type is null)
169
and rec.type = &apos;RECEIVED_EMAIL_FROM_CUSTOMER&apos; 
169
and (rec.type = &apos;RECEIVED_EMAIL_FROM_CUSTOMER&apos; or rec.type = &apos;RECEIVED_CALL_FROM_CUSTOMER&apos; )
170
and (res.creationTimestamp = (select min(a.creationTimestamp) from activity a where a.ticketId = rec.ticketId and a.creationTimestamp &gt; rec.creationTimestamp and a.type = &apos;SEND_EMAIL_TO_CUSTOMER&apos;) 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 &gt; rec.creationTimestamp and (a.type = &apos;SEND_EMAIL_TO_CUSTOMER&apos; or a.type = &apos;CALLED_CUSTOMER&apos; or a.type = &apos;ESCALATE_TICKET&apos;)) or res.creationTimestamp is null);</sql>
171
    <limit>0</limit>
171
    <limit>0</limit>
172
    <lookup/>
172
    <lookup/>
173
    <execute_each_row>N</execute_each_row>
173
    <execute_each_row>N</execute_each_row>
174
    <variables_active>N</variables_active>
174
    <variables_active>N</variables_active>
175
    <lazy_conversion_active>N</lazy_conversion_active>
175
    <lazy_conversion_active>N</lazy_conversion_active>