Creating export of tickets with comments

Hello,

I am trying to make an export of all tickets in a queue using an
SQL-query. I’ve succeeded in creating a query including all custom
fields (see below).

In addition I also need all the comments with the tickets. Is there a
way to do this and put them in a .csv or excell?

Greetings, Floor Verschure

////////////////////////////////////////////////////////////////////////

SELECT t.id, t.subject, t.priority, t.created, t.status,
t.resolved, c37.content AS ‘Eneco Ref. Nr.’,c40.content AS ‘Aspective
Ref. Nr.’ , c38.content AS ‘Downtime’,c39.content AS ‘Workaround’

FROM Tickets t

LEFT JOIN TicketCustomFieldValues c38 ON (t.id = c38.ticket AND
c38.customfield = 38)
LEFT JOIN TicketCustomFieldValues c37 ON (t.id = c37.ticket AND
c37.customfield = 37)
LEFT JOIN TicketCustomFieldValues c39 ON (t.id = c39.ticket AND
c39.customfield = 39)
LEFT JOIN TicketCustomFieldValues c40 ON (t.id = c40.ticket AND
c40.customfield = 40)

WHERE t.Queue=44

///////////////////////////////////////////////////////////////////////

Floor,

Are these tickets already in a queue in RT? If so, why are you using 

SQL-Query when you could use the RT-Search/Bulk Update option? Just curious.

Kenn
LBNLOn 5/9/2008 4:28 AM, Floor Verschure wrote:

Hello,

I am trying to make an export of all tickets in a queue using an
SQL-query. I’ve succeeded in creating a query including all custom
fields (see below).

In addition I also need all the comments with the tickets. Is there a
way to do this and put them in a .csv or excell?

Greetings, Floor Verschure

////////////////////////////////////////////////////////////////////////

SELECT t.id, t.subject, t.priority, t.created, t.status,
t.resolved, c37.content AS ‘Eneco Ref. Nr.’,c40.content AS ‘Aspective
Ref. Nr.’ , c38.content AS ‘Downtime’,c39.content AS ‘Workaround’

FROM Tickets t

LEFT JOIN TicketCustomFieldValues c38 ON (t.id = c38.ticket AND
c38.customfield = 38)
LEFT JOIN TicketCustomFieldValues c37 ON (t.id = c37.ticket AND
c37.customfield = 37)
LEFT JOIN TicketCustomFieldValues c39 ON (t.id = c39.ticket AND
c39.customfield = 39)
LEFT JOIN TicketCustomFieldValues c40 ON (t.id = c40.ticket AND
c40.customfield = 40)

WHERE t.Queue=44

///////////////////////////////////////////////////////////////////////


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com