[rt-users] Is it possible to do a table join in a query?

Ruslan Zakirov ruz at bestpractical.com
Tue Mar 27 17:25:30 EDT 2012


On Mon, Mar 26, 2012 at 22:04, Paul Tomblin <ptomblin at xcski.com> wrote:
> I would like to put a group name into a custom field, and then see only the
> tickets in a certain queue where that group is a group that I belong to.  I
> know how to do this from pgsql:
>
> select t.*
> from tickets t
> join queues q on t.queue = q.id
> join objectcustomfieldvalues ocfv on objecttype = 'RT::Ticket' and objectid
> = t.id
> join customfields on customfields.id = ocfv.customfield
> join groups on groups.name = ocfv.content
> join groupmembers on groupmembers.groupid = groups.id
> where q.name = 'rtqueue1' and
> customfields.name = 'group_assigned' and
> groupmembers.memberid = 24 and
> t.disabled = 0 and q.disabled = 0 and ocfv.disabled = 0;
>
>
> but is it possible to do this sort of thing in a custom query?

If you want this available in the query builder then you have to
extend Tickets.pm to support new TicketSQL.

You can do this in code without TicketSQL, but component would be
custom and less flexible.


>
> --
> http://www.linkedin.com/in/paultomblin
> http://careers.stackoverflow.com/ptomblin
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list