The order of the columns in GROUP BY doesn`t matter?  why?

I did a little test and find out that the order of the columns in GROUP BY does not matter to ORACLE.
Why? How does oracle do GROUP BY exactly?
Could anyone show me its processing logic? maybe in pseudo-code?
Thanks in advance.

I mean,
I thought oracle would group data based on the order of the columns in the GROUP BY LIST.
For example: for select deptno, job, count(*) from emp group by deptno, job;
I thought, oracle first would group the data based on deptno (10,20,30), e.g. in deptno=30, we got 6 employees.
and then, group this 6 employees based on JOB (CLERK, SALESMAN, MANAGER).and
for select job, deptno, count(*) from emp group by job, deptno;
first would group the data based on JOB (CLERK, SALESMAN, MANAGER) e.g., for CLERK, we got 4 employees,
and then, group this 4 employees based on deptno (10,20, 30).and to me, it seems that in some circumstances, their result could be different.
So, I wonder if the order of the columns in GROUP BY Clause matter?

Similar Messages

  • Problem with the order of the columns of a ALV

    I have a problem with a ALV, variants we keep this ALV does not record the order of the columns
    Thank you

    I suppose you want to change the sequence of columns of a ALV. If you can change it by clicking 'settings' of right-top corner of ALV. After done you can save the new settings into a new. If you find some abnormal behaviour, please check the settings by WDA component "wd_analyze_config_user".
    FYI.
    [http://help.sap.com/saphelp_nw70/helpdata/en/32/f26f73d81e11d1a26f0000e8a5a614/frameset.htm]

  • The order of the table columns to Srini Chavali

    OK I made a mistake Srini Chavali.
    So why dont you try to help me now beyond just warn me about burocratic issues, what you really should had done instead just to block the answers of my former question ?
    The question is:
    How to influence the order of the table columns in time of transformation logic to relational ?
    Nelson Alberti da Rosa

    because exist an order among primary key columns that was definied in the logical model and it he can't see that.fixed :
    function addPKcolumns(list,table){
         pk = table.getPK();
         if(pk!=null){
              pcols = pk.getColumns();
              for(var i = 0;i<pcols.length;i++){
                   col = pcols;
                   //in fact don't need this check, because PK columns are processed first
                   if(!list.contains(col)){
                        list.add(col);
    function addFKcolumns(list,fkeys){
         for(var k=0;k<fkeys.length;k++){
              fcols = fkeys[k].getColumns();
              for(var i = 0;i<fcols.length;i++){
              col = fcols[i];
              if(!list.contains(col)){
                   list.add(col);
    //adds mandatory or oprional columns to list depending on mand parameter
    function addMandatoryOptColumns(list,cols, mand){
         for(var i = 0;i<cols.length;i++){
              col = cols[i];
              if(col.isMandatory() == mand && !list.contains(col)){
                   list.add(col);
    tables = model.getTableSet().toArray();
    list = new java.util.ArrayList();
    for (var t = 0; t<tables.length;t++){
         list.clear();
         table = tables[t];
         cols = table.getElements();
         // add PK columns to list
         addPKcolumns(list,table);
         // add FK columns to list
         addFKcolumns(list,table.getFKAssociations());
         //add mandatory columns
         addMandatoryOptColumns(list,cols,true);
         //add optional columns
         addMandatoryOptColumns(list,cols,false);
         //use list to reorder columns
         ord_cols = list.toArray();
         for(var n = 0;n<ord_cols.length;n++){
              table.moveToIndex(ord_cols[n],n);
         //prevent reordering from enginnering, can be changed with UI
         table.setAllowColumnReorder(false);
         table.setDirty(true);

  • How to change the order of the columns in the Message List in Mail?

    In Mail, in the Message List, is it possible to rearrange the column order of Subject, From, Date, Attachments, etc?
    The upgrade to Snow Leopard changed the order of the above and I want to keep the old order that I had with Leopard.
    Also, there is a column which has a black circle in it. What does it mean? I don't mean the smaller black circle, because that shows which emails been read and which are not yet read.
    Thank you.
    Lorna

    To arrange columns, click on column title (To or From) and drag right or left.
    The black dot column shows the type of message. There will be a counterclockwise arrow if the email is a response to a previous email or there will be an icon of a note if the message is a note

  • How to change the order of the columns in system matrix?

    Hi all,
    Is there any way to change the order of the columns in system matrix through SDK, without doing it from 'Form settings'??

    Hi ,
    is this true for the 'Active' property also , in CPRF table? I want to check whether the Item is active or not becuse, when I m trying to copy the value in item which is not active, I m given error. Is there any way to change or active the 'Active' flag in form settings at run-time?
    Any clue?
    Thanks in advance,......
    Binita

  • Changing the order of report columns

    Hi
    I am using Application Express 4.1.1.00.23 and have created a report. What I can't seem to alter however is the order of the columns generated by the report.
    It's not based on the SQL query because for example the 'Surname' field is 2nd in the select statement but on the report view the Surname column is the last column.
    Is there a way of changing the order??

    Simple, Edit your report page > under region click Report hyper link corresponding to your report.
    There you will see list of columns where you can order the report columns using little icons on the far right. remember to click apply changes after re-ordering the columns.
    Thanks

  • Sometimes when I play songs in Itunes by double clicking on them, Itunes will place the song as the first one on the album.  It will chnage the order of the songs on the album, and I can not switch them back to the correct order.

    Sometimes when I play songs in Itunes by double clicking on them, Itunes will place the song as the first one on the album.  It will chnage the order of the songs on the album, and I can not switch them back to the correct order.  This onloy seems to happen when I double-click on the song to play it in itunes.  If I just hit play, this doesnt happen.  As a result, I have several albums now in which the songs are in the wrong order.  Its very frustrating, as this error then transfers over to my ipod every time I sync it.  When I choose the info. for the songs, it has them correctly listed (i.e., it lists the songs as being #1 of 19 on the CD, for example).  But then the song will have placed by Itunes as #5 of 19 for whatever reason.  Itunes does not do this every time, but does it with enough frequency to be maddening.  Any thoughts?

    The problem of tracks becoming de-linked between iTunes and the music files in your iTunes music folder happens for different reasons - this seems to come up fairly commonly in this forum.
    The solution can be to locate each song in the iTunes library, as you mentioned - or, but wait, before I get to that...
    trouble finding the original track in your iTunes music folder? maybe look for it under compilations, or if not using the 'group compilations preference' then look in the folder under the songs artist name, but what song artist name iTunes uses depends on what you have in the metedata tag spot for album artist or song artist. Any varyation in artist name spelling, in the menu item 'get info' metadata for any selected individual track will cause iTunes to create that as a separate artist folder in the library, even names like 'various' or any difference at all (even the word 'the' can change where in your iTunes music folder a track gets placed by iTunes). You can try to use the finder function of find file (finder munu item outside of iTunes) to locate hard to find items.
    Back to how to re-link any de-linked tracks .
    There may be scripts that can help re-link de-linked music files - or, at least provide you a list of such files, Scripts are easy to install and use...
    at Dougs Scripts, there is one called iTunes Track CPR that might work
    http://dougscripts.com/itunes/scripts/ss.php?sp=itunestrackcpr
    or, if you just want a list of de-linked tracks, go to
    http://dougscripts.com/itunes/
    and find the script called List MIA's, this will create a text file listing all de-linked tracks
    if you review the thread at
    https://discussions.apple.com/thread/3633708
    also the thread at
    https://discussions.apple.com/message/17513078#17513078
    you may find more insight into dealing with this kind of issue there, although some of that thread may not apply to your case, aspects of it might help.
    Good luck.

  • ITunes 10.6.3 keeps generating incomplete downloads AND it rearranges the order of the playlist when I burn a playlist to an mp3 cd

    iTunes 10.6.3 keeps generating incomplete downloads AND it rearranges the order of the playlist when I burn a playlist to an mp3 cd.
    I purchased an album on iTues from my MAC book Pro & the song downloads were incomplete. The song length shows correctly in the column, but they cut off between 1/4 & 1/2 way through the songs. Now, I dwonloaded it on my iPhone 4 through my itunes account after the purchase & the songs play fine. This happened with the very next song I purchased, as well.
    I got around this issue, then created mp3 versions of all the songs, put them in their own playlist, then "Burned an mp3 disc." When it completed, the songs were in a different order.
    Are there any fixes for either of these problems/bugs?

    iTunes: How to set the play order of songs on an MP3 CD - http://support.apple.com/kb/HT2455

  • HT1660 How do I change the order of the songs in a playlist?

    How do I change the order of the songs on a playlist.  The songs seem to have rearranged themselves.

    When viewing a playlist the left most column of numbers is the Play Order. If you click the heading of this column then it should restore the previously defined order. You will also be able to drag tracks up and down the list. If you decide to sort on another column heading, say Album by Artist, you can right-click the playlist name and then click Copy to Play Order to ensure the new order is copied to any device that syncs with the library.
    tt2

  • Sometimes when I put a CD in memory the order of the tracks is changed in memory from what is was on the disc.  I would rather have in the same as the original disc.  Is that possible?

    Sometimes when I put a CD into iTunes the order of the tracks is changed.  How can I avoid this?

    The order in which the tracks are displayed depends on the column selected in list view.  Select the album column to display tracks in album order.

  • For all entries changes the order of the itab

    Hi Experts
                 In the following query i have used two internal tables namely it_first and it_zlist.
                The material inwhich the it_zlist is different sorting order
          After executing this query, the order of the material inwhich the it_first is different from the it_zlist.
                 What could be the reason, pls explain me on this.
    select matnr test zsno ztnam from zmaster1
                into corresponding fields of table it_first
                      for all entries in it_zlist
                      where matnr = it_zlist-matnr.
    Thanks in advance.
    Regards
    Rajaram

    for all entries u should specified all primary key.
    sort by u condition.
    Effect
    If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators.
    The internal table itab must have a structured line type and the component comp must be compatible with the column col.
    The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY.
    The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set.
    Notes
    In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO.
    The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement.
    If the additions PACKAGE SIZE or UP TO n ROWS are specified together with FOR ALL ENTRIES, they are not passed to the database system but are applied instead to the resulting set once all selected rows on the application server have been imported.
    With duplicated rows in the resulting set, the addition FOR ALL ENTRIES has the same effect as if addition DISTINCT were specified in the definition of the selection quantity. Unlike DISTINCT, the rows are not deleted from the database system but are deleted on the application server from the resulting set.
    Addition FOR ALL ENTRIES is only possible for WHERE conditions of the SELECT statement.
    Example
    Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.

  • In-list: does oracle follow the order of the items in the in-list?

    We have a partition table, each partition has one day's data. And we are using 4 partitions, every day the oldest partition will be truncated so that it could be reused next day. Some data will be sit in more than 1 partitions, and we need to get the newest data. The current partition has a partition_key=MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') + 1, 4).
    If oracle obeys the order of the items in the in-list, then the following sql should work and has the least cost. But I am not sure whether oracle run time engine will obey the order. I recalled Lewis had said run time engine might not follow the plan in the execution plan (explain plan).
    select *
      from tab
    where id=:id and partition_key in
           (MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') + 1, 4),
            MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') , 4),
            MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') -1, 4),
            MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY')-2, 4)) and rownum=1;If oracle doesn't follow the order in the in-list, does oracle follow the order of subquery in "union all", such as
    select * from
           select * from tab where where id=:id and partition_key =MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') + 1, 4)
              union all
           select * from tab where where id=:id and partition_key =MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') , 4)
              union all
           select * from tab where where id=:id and partition_key =MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') - 1, 4)
              union all
           select * from tab where where id=:id and partition_key =MOD(TRUNC(SYSDATE) - TO_DATE('01-JAN-2005', 'DD-MON-YYYY') - 2, 4)
    where rownum=1

    Is there an Oracle version number on your database?
    Is "Lewis" Jonathan Lewis? If so please post a link to his comment so we can read it and understand what you are referring to.
    If your table is indeed partitioned then please post the DDL that created it ... not every column but at least the partition key
    and the partioning template.
    Please also post your explain plan report generated from your DML statements by dbms_xplan.display.
    We can not help with what we can not see.

  • The order of the keys in a Map (or something to replace Map)

    Hello,
    I got a map from a third map API, it stores the key and value in a certain order.
    I should dispaly them without changing the order.
    I made a simulation by:
                   for(int j=1; j<=5; j++) {
                   map.put("Column Title "+j, "item ("+i+", "+j+")" );
                   }     When I displayed it (In a web application JSP Taglib ...) by                     
              Set set = map.keySet();
              Iterator ite = set.iterator();
              while (ite.hasNext()) {
                   String columnName = (String)ite.next();
                   outSB.append("<td><b>"+columnName+"</b></td>");
              I found it displayed as
    Column Title 5 | Column Title 3 | Column Title 4 |Column Title 1 |Column Title 2
    It is not
    Column Title 1 | Column Title 2 | Column Title 3 |Column Title 4 |Column Title 5
    Therefore, I lost the control of the order.
    How can I control this order of key? (I don't want it be sorted but respect the order that the data were put!!!)
    Thanks.
    Penyou

    OleVV wrote:
    I haven't tried this myself, but I believe you will want to study the SortedMap interface and its implementing classes.Thanks.
    As I said in my question, I don't want to sort the keys. Because those keys and their orders are defined by a third part. For example, it some one askes to diaply in the following order:
    Firstname | Lastname | Iterm
    If I sorted, it would be either
    Firstname | Iterm | Lastname
    Lastname | Iterm | Firstname
    I am not satisfied with this.

  • Any way to change the order of the items in the Files Inspector? DW CS4

    Hi,
    I'm using Dreamweaver CS4 with my menus split virtically.
    Is there any way to change the order of the items in the Files Inspector?
    Specifially I'd like to have them in this order:
    | Local/Remote Files | Modified | Size | Type |
    The reason being that next to the 'Local Files' the 'Modified' column is most impotant for putting updated files/images, and in split vertical mode I have to scroll right to see the 'Modified' column.
    Is this a feature request?
    Rich

    Is there any way to change the order of the items in the Files Inspector?
    Yes, but it must be done on a site-by-site basis.
    In the Site Definition dialog box, select File View Columns. You can control the position and display of columns there. The only one that can't be changed is Name.

  • Why won't my music copy in the order on the playlist?

    Hi,
    Can someone help me please?  I am copying over my music (from my I Tunes library) for a dance class tonight and everytime I play it on my phone or Ipod the order comes out differently and it's jumbled up.  Why?
    Thanks

    Is your playlist set to "Manual order"? Click the the left-most column header for manual sort. Then drag and arrange the songs to the order you want.
    Does that not work?
    Léonie

Maybe you are looking for

  • Multiple controllers and AU plugins (or software instruments)

    Hello, This is my situation: 4 students and 4 (electronic) pianos (that can send on different channels). I also use Logic Pro 9. Midi interface with 4 ports I want these 4 students play together performing something like an orchestral score, ie piano

  • Driver "Intel(R) HM76 Express Chipset LPC Controller - 1E59" has a yellow exclamation mark.

    The Driver "Intel(R) HM76 Express Chipset LPC Controller - 1E59"  has a yellow exclamation in Divice Manager. How do I remove it? I just completed clean install of Windows 8 and this driver seems to be for windows 7. Solved! Go to Solution.

  • Fire wires

    Hi. I've got an iMac that is about a year old running 10.6.8.  I have just bought a new Macbook Pro and want to transfer some files across. I've followed the discussions about firewires and can see what to do but am not sure which fire wire cable I n

  • Got the "replace battery" message...

    I've read numerous things on this, one is that the message isn't accurate and just a error that occurs though your battery is still working perfectly, the other is that it really damages your battery, could someone please inform me on which is true? 

  • Physical Inventory Problem

    Hi Gurus Presently I am doing the physical inventory thru Batches. the process is : MI31 MI24 MI04 MI20 MI07 My client want physical inv stock in to one batch only. So i can count all batches stock  put in to one batch. if i did like that wht is the