<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:Verdana;
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
span.EmailStyle18
{mso-style-type:personal;
font-family:Verdana;
color:navy;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:Verdana;
color:navy;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>All<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>I ran this issue by one of our DBAs and
this is his comment:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>Charles,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>The problem with the following query is that the summary
statement (GROUP BY) references the wrong column. The query is doing a summary
count by user name. The table.column_name in the SELECT clause has to match the
table.column_name in the GROUP BY clause.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><b><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana;font-weight:bold'>Incorrect:<o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>SELECT COUNT(main.id) AS id, <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> <font color=red><span
style='color:red'>Users_2.Name</span></font><font color=blue><span
style='color:blue'> </span></font>AS col1 <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>FROM Tickets main <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>LEFT JOIN Users Users_2 ON ( Users_2.id = main.Owner
) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>LEFT JOIN Users Users_1 ON ( Users_1.id = main.Owner
) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>WHERE (main.Status != 'deleted') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.Status = 'resolved' <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND main.Queue = '5') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.Type = 'ticket') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.EffectiveId = main.id) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>GROUP BY <font color=red><span style='color:red'>Users_1.Name</span></font>;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=red face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:red'>ORA-00979: not a GROUP BY expression<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><b><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana;font-weight:bold'>Correct:<o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>SELECT COUNT(main.id) AS id, <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>
<font color=blue><span
style='color:blue'>Users_2.Name </span></font>AS col1 <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>FROM Tickets main <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>LEFT JOIN Users Users_2 ON ( Users_2.id = main.Owner
) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>LEFT JOIN Users Users_1 ON ( Users_1.id = main.Owner
) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>WHERE (main.Status != 'deleted') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.Status = 'resolved' <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND main.Queue = '5') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.Type = 'ticket') <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> AND (main.EffectiveId = main.id) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>GROUP BY <font color=blue><span style='color:blue'>Users_2.Name</span></font>;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>I executed the correct version as user RT3 and got these
results:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><b><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana;font-weight:bold'>
ID COL1<o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>---------- ----------<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> 8 Nobody<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> 6 ---<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> 1 ---<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'> 3 root<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>Regards,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>John<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>The question is: where do I make the
correction to the query?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>Thanks in advance for the assist!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><strong><b><font size=2 color=navy face=Verdana><span
style='font-size:10.0pt;font-family:Verdana;color:navy;font-weight:normal'>-CK</span></font></b></strong><b><font
color=navy><span style='color:navy;font-weight:bold'><o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'> </span></font><o:p></o:p></p>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Charles Kugelman<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, April 15, 2009
8:43 AM<br>
<b><span style='font-weight:bold'>To:</span></b> rt-users@lists.bestpractical.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rt-users] Report
"Resolved by owner" fails to output,generates error in log</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>Any thoughts on this? Does this appear
to anyone to be a bug?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><strong><b><font size=2 color=navy face=Verdana><span
style='font-size:10.0pt;font-family:Verdana;color:navy;font-weight:normal'>-CK</span></font></b></strong><b><font
color=navy><span style='color:navy;font-weight:bold'><o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'> </span></font><o:p></o:p></p>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Charles Kugelman<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, April 13, 2009 12:25
PM<br>
<b><span style='font-weight:bold'>To:</span></b> rt-users@lists.bestpractical.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> [rt-users] Report
"Resolved by owner" fails to output,generates error in log</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>All,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>It’s been pointed out that the “Resolved by
owner” report isn’t outputting results. I looked in the RT error
log and found the entries below. Thoughts?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>---Relevant Info---<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- RT Version: 3.8.2<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- HTTPD Package (RPM): httpd-2.2.3-22.el5<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- Mod_Perl Package (RPM): mod_perl-2.0.4-6.el5<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- Perl Package (RPM): perl-5.8.8-18.el5 <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- OS: RedHat Enterprise Linux 5<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- Oracle Client: 10.2, Instant Client<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- Oracle Server (remote server): 11g<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>- Mail Package (RPM): postfix-2.3.3-2<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>---Errors---<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>[Mon Apr 13 16:08:14 2009] [warning]: DBD::Oracle::db
prepare failed: ORA-00979: not a GROUP BY expression (DBD ERROR: error possibly
near <*> indicator at char 29 in 'SELECT COUNT(main.id) AS id,
<*>Users_2.Name AS col1 FROM Tickets main LEFT JOIN Users Users_2
ON ( Users_2.id = main.Owner ) LEFT JOIN Users Users_1 ON ( Users_1.id =
main.Owner ) WHERE (main.Status != 'deleted') AND (main.Status =
'resolved' AND main.Queue = '5') AND (main.Type = 'ticket') AND
(main.EffectiveId = main.id) GROUP BY Users_1.Name ') [for Statement
"SELECT COUNT(main.id) AS id, Users_2.Name AS col1 FROM Tickets main LEFT
JOIN Users Users_2 ON ( Users_2.id = main.Owner ) LEFT JOIN Users
Users_1 ON ( Users_1.id = main.Owner ) WHERE (main.Status !=
'deleted') AND (main.Status = 'resolved' AND main.Queue = '5') AND (main.Type =
'ticket') AND (main.EffectiveId = main.id) GROUP BY Users_1.Name "]
at /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 465,
<GEN79> line 130.
(/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm:465)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>[Mon Apr 13 16:08:14 2009] [warning]:
RT::Handle=HASH(0x2b9ff6d2c540) couldn't prepare the query 'SELECT
COUNT(main.id) AS id, Users_2.Name AS col1 FROM Tickets main LEFT JOIN Users
Users_2 ON ( Users_2.id = main.Owner ) LEFT JOIN Users Users_1 ON (
Users_1.id = main.Owner ) WHERE (main.Status != 'deleted') AND
(main.Status = 'resolved' AND main.Queue = '5') AND (main.Type = 'ticket') AND
(main.EffectiveId = main.id) GROUP BY Users_1.Name 'ORA-00979: not a
GROUP BY expression (DBD ERROR: error possibly near <*> indicator at char
29 in 'SELECT COUNT(main.id) AS id, <*>Users_2.Name AS col1 FROM Tickets
main LEFT JOIN Users Users_2 ON ( Users_2.id = main.Owner ) LEFT JOIN
Users Users_1 ON ( Users_1.id = main.Owner ) WHERE (main.Status !=
'deleted') AND (main.Status = 'resolved' AND main.Queue = '5') AND (main.Type =
'ticket') AND (main.EffectiveId = main.id) GROUP BY Users_1.Name ') (/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm:472)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Verdana><span style='font-size:10.0pt;
font-family:Verdana'><o:p> </o:p></span></font></p>
<p class=MsoNormal><strong><b><font size=2 face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;font-weight:normal'>-CK</span></font></b></strong><b><span
style='font-weight:bold'><o:p></o:p></span></b></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>