Query to show last correspondence on new/open tickets

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Forum rules
Dont create your support topics here! No new topics with questions allowed!
Post Reply
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Query to show last correspondence on new/open tickets

Post by crythias »

This query will show last visible to customer entries for all new and open tickets:

Code: Select all

SELECT "ticketnumber", "title", "service", "owner", "customer", "from", "to", "subject", "body", "when" UNION
SELECT t.tn tn, t.title title, s.name as service, u.login owner, t.customer_user_id customer, a.a_from "from", a.a_to "to", a.a_subject subject, a.a_body body, a.create_time "when"
FROM `ticket` t left join service s on s.id=t.service_id left join users u on u.id = t.user_id left join (
select max(a1.id), a1.ticket_id, a1.a_body, a1.a_subject, a1.a_from, a1.a_to, a1.create_time from article a1 left join ticket t on t.id=a1.ticket_id where a1.article_type_id in (1,8,10) group by a1.ticket_id) a on a.ticket_id = t.id
where t.ticket_state_id in (1,4)
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply