Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: group by sorting
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C038B5.EF042260
Content-Type: text/plain;
charset="iso-8859-1"
If I understood correctly then I feel this should work
SELECT col1, col2, col3, SUM(col4), MIN(Col5), .....
GROUP BY Col1, Col2, Col3
ORDER BY col1 DESC, col2, Col3 DESC
Aleem
-----Original Message-----
From: Bowes, Chris [mailto:Chris.Bowes_at_kosa.com]
Sent: Wednesday, October 18, 2000 3:23 AM
To: Multiple recipients of list ORACLE-L
Subject: group by sorting
I have looked in a couple manuals for this but have not found it. When doing a group by, a sort is done on the data. Is there anyway to specify a descending order for that sort? It is defaulted to ascending. Is there a way of overriding that? I told the developer that she should put it into a subquery but the query itself (all 3 pages) is already complex enough. Any ideas? Thank you in advance.
--Chris
Chris.Bowes_at_Kosa.com
------_=_NextPart_001_01C038B5.EF042260
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 9">
<meta name=3DOriginator content=3D"Microsoft Word 9">
<link rel=3DFile-List href=3D"cid:filelist.xml_at_01C038DE.5B464180">
<title>group by sorting</title>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>0</w:Zoom> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:EnvelopeVis/>
{font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:16792199 0 0 0 65791 0;}/* Style Definitions */
{mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p {margin-right:0in; mso-margin-top-alt:auto; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} span.EmailStyle16 {mso-style-type:personal-reply; mso-ansi-font-size:10.0pt; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;}
<body lang=3DEN-US style=3D'tab-interval:.5in'>
<div class=3DSection1>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>I=
f I
understood correctly then I feel this should =
work<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><= ![if =
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>S=
ELECT
col1, col2, col3, SUM(col4), MIN(Col5), ….. =
<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>G=
ROUP BY
Col1, Col2, Col3<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>O=
RDER BY
col1 DESC, col2, Col3 DESC<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><= ![if =
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>A=
leem<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D2 =
color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><= ![if =
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblack
face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma;color:black'>-----Original
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Bowes, Chris
[mailto:Chris.Bowes_at_kosa.com]<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, October =
18, 2000
3:23 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> Multiple recipients =
of list
ORACLE-L<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> group by =
sorting</span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'><![if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></p>
<p style=3D'margin-left:.5in'><font size=3D2 color=3Dblack =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:black'>I have looked =
in a
couple manuals for this but have not found it. When doing a group =
by, a
sort is done on the data. Is there anyway to specify a descending order =
for
that sort? It is defaulted to ascending. Is there a way of
overriding that? I told the developer that she should put =
it into a
subquery but the query itself (all 3 pages) is already complex =
enough.
Any ideas? Thank you in advance.</span></font><font =
color=3Dblack><span
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font>=
</p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'><![if =
!supportEmptyParas]> <![endif]></span></font><font
color=3Dblack><span =
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font>=
</p>
<p style=3D'margin-left:.5in'><font size=3D2 color=3Dblack =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:black'>--Chris</span><=
/font><font
color=3Dblack><span style=3D'color:black'> <br>
</span></font><font size=3D2 color=3Dblack face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;color:black'>Chris.Bowes_at_Kosa.com</span></font><font
color=3Dblack><span style=3D'color:black'> </span></font><font =
Received on Tue Oct 17 2000 - 22:45:59 CDT
![]() |
![]() |