From Request Tracker Wiki
Jump to navigation Jump to search

The following query selects Tickets by id of a Watcher

MySQL variant of the query

    u.Name user_name,
    g.Type role, ticket_id,
    t.Subject subject
    Users u,
    CachedGroupMembers cgm,
    Groups g,
    Tickets t
WHERE = 12
    AND cgm.MemberId =
    AND = cgm.GroupId
    AND g.Domain = 'RT::Ticket-Role'
    AND = g.Instance


  • limit users by id, however you can use other restrictions: = 12
AND cgm.MemberId =
  • only Groups table has info we need, so join it:
AND = cgm.GroupId
  • Role groups of a ticket have Domain = 'RT::Ticket-Role'
AND g.Domain = 'RT::Ticket-Role'
  • Values in the Instance column of the Groups table are ids of tickets. Note, that it only applies when you limit Domain, groups in other domains may point to other objects (Users, Queues...):
AND = g.Instance

That's all. If you want to see tickets where the user is requestor only then you can add:

AND g.Type = 'Requestor'

See also