[rt-users] DB Query

Steen Olesen SO at schilling.dk
Wed May 9 03:26:58 EDT 2007


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: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of John Paul
Hayes
	Sent: Tuesday, May 08, 2007 6:25 PM
	To: rt-users at lists.bestpractical.com
	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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20070509/0eb38d83/attachment.htm>


More information about the rt-users mailing list