Hi All,<br><br>Thank you for the help, very much appreciated.<br><br><div><span class="gmail_quote">On 5/9/07, <b class="gmail_sendername">Steen Olesen</b> <<a href="mailto:SO@schilling.dk">SO@schilling.dk</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hi,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">In our RT we have a ticket-custom field holding the
Customer Id. The following SQL shows the number of tickets per customer
id:</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">select<br> objcf1.content CustomerId, count(*)
TicketCount<br>from<br> tickets, customfields cf1,
objectcustomfieldvalues objcf1<br>where<br>
objcf1.objectid=tickets.id<br> and
objcf1.objecttype='RT::Ticket'<br> and
objcf1.customfield=cf1.id<br> and cf1.name='Customer
ID'<br> and tickets.status in
('new','open','stalled','offer')<br>group by<br>
objcf1.content<br></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">The syntax for the SQL may vary depending on the database
(we're running Oracle).</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> </font></span></div>
<div><span></span><font face="Arial"><font color="#0000ff"><font size="2">/<span>Steen</span></font></font></font><br></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="da">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rt-users-bounces@lists.bestpractical.com</a>
[mailto:<a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rt-users-bounces@lists.bestpractical.com</a>] <b>On Behalf Of </b>John
Paul Hayes<br><b>Sent:</b> Tuesday, May 08, 2007 6:25 PM<br><b>To:</b>
<a href="mailto:rt-users@lists.bestpractical.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rt-users@lists.bestpractical.com</a><br><b>Subject:</b> [rt-users] DB
Query<br></font><br></div><span class="q">
<div></div>Hi All,<br><br>I am running a script with accesses the rtdb
directly (for speed purposes). One of the requirements is that I have to
<br>find any ticket what was resolved with a custom field entry
selected.<br><br>Does anybody know off hand how to link a ticket id to the
custom field entry id in the db? <br><br>Thanks in advance,<br>JP<br clear="all"><br><br><br><br>-- <br><br>"If you make people think they're
thinking, they'll love you; but if you really make them think they'll hate
you."<br><br>— Don Marquis </span></blockquote></div>
</blockquote></div><br><br clear="all"><br>-- <br><br>"If you make people think they're thinking, they'll love you; but if you really make them think they'll hate you."<br><br>— Don Marquis