Hi,
 
In our RT we have a ticket-custom field holding the Customer Id. The
following SQL shows the number of tickets per customer id:
 
select
   objcf1.content CustomerId, count(*) TicketCount
from
   tickets,   customfields cf1, objectcustomfieldvalues objcf1
where
   objcf1.objectid=tickets.id
   and objcf1.objecttype='RT::Ticket'
   and objcf1.customfield=cf1.id
   and cf1.name='Customer ID'
   and tickets.status in ('new','open','stalled','offer')
group by
   objcf1.content

The syntax for the SQL may vary depending on the database (we're running
Oracle).
 
/Steen


________________________________

        From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Paul
Hayes
        Sent: Tuesday, May 08, 2007 6:25 PM
        To: [email protected]
        Subject: [rt-users] DB Query
        
        
        Hi All,
        
        I am running a script with accesses the rtdb directly (for speed
purposes). One of the requirements is that I have to 
        find any ticket what was resolved with a custom field entry
selected.
        
        Does anybody know off hand how to link a ticket id to the custom
field entry id in the db? 
        
        Thanks in advance,
        JP
        
        
        
        
        -- 
        
        "If you make people think they're thinking, they'll love you;
but if you really make them think they'll hate you."
        
        - Don Marquis 

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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

Reply via email to