[rt-users] Is it possible to do a table join in a query?
Kevin Falcone
falcone at bestpractical.com
Tue Mar 27 18:00:07 EDT 2012
On Mon, Mar 26, 2012 at 02:04:46PM -0400, Paul Tomblin 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:
I assume you mean "From TicketSQL, as available in the Advanced tab in
the Query Builder" ?
Unfortunately, you can't do arbitrary joins from TicketSQL but you
could do it from perl space (see the docs on DBIx::SearchBuilder for
Join syntax).
-kevin
> select t.*
> from tickets t
> join queues q on t.queue = [1]q.id
> join objectcustomfieldvalues ocfv on objecttype = 'RT::Ticket' and objectid = [2]t.id
> join customfields on [3]customfields.id = ocfv.customfield
> join groups on [4]groups.name = ocfv.content
> join groupmembers on groupmembers.groupid = [5]groups.id
> where [6]q.name = 'rtqueue1' and
> [7]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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120327/a13e0380/attachment.sig>
More information about the rt-users
mailing list