Sort order for group by functions

I have table TAB1(notenum number, linenum number, linetext varchar2(100)).
Each note can have multiple lines of text. Eg data
NOTENUM     LINENUM     LINETEXT
1     1     THIS IS LINE1.
1     2     THIS IS LINE2.
2     1     THIS IS LINE1 OF NOTE2.
2     2     THIS IS LINE2 OF NOTE2.
I need the text of lines of the most recent note (max notenum)
<Note>THIS IS LINE1 OF NOTE2. THIS IS LINE2 OF NOTE2</Note>.
I have a query like this
SELECT XMLAGG(XMLPARSE(CONTENT LINETEXT WELLFORMED))
FROM TAB1
GROUP BY NOTENUM
ORDER BY NOTENUM DESC
Above query would return the text of all lines concatenated for each note and the first row would be the one with highest notenum value.
My problem is that concatenation of the LINETEXT should happen in ascending order of LINENUM. Since LINENUM is not in GROUP BY clause I cannot specify it in ORDER BY.
How can I specify to XMLAGG (for that matter any group by function) to concatenate text in a specific order.
I hope I was able to explain my problem clear enough for somebody to help.
thanks for all the help
Message was edited by:
user448703
Message was edited by:
user448703

Never mind. I just found out that XMLAGG function has the option to specify ORDER BY. I think that will work.

Similar Messages

  • Sort order for Simplified Chinese (pinyin)

    FrameMaker 10 (Windows)
    It seems that if I specify the sort order for Simplified Chinese (pinyin) on the reference page,
    index entries that start with "i" and "v" are not shown under their corresponding group titles.
    (I assume that this may be due to the fact that pinyin words never start with these letters.)
    If I have an entry that starts with an English word like "IP," it appears under the "J" group.
    I want the entry to appear under the "I" group. How can I do this?
    I have the IX reference page set up as follows:
    GroupTitlesIX paragraph
    Symbols[\];Numerics[0];A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;
    SortOrderIX paragraph
    <$symbols><$numerics><$alphabetics><$pinyin>
    I've also tried:
    SortOrderIX paragraph
    <$symbols><$numerics><$pinyin>
    Thanks in advance.
    Tak Osato

    I sort of found a workaround, but it may lead to other problems, so use it at your own risk.
    It also requires a bit of work.
    The idea is to use the sort order for Japanese by specifying the following in the IX reference page.
    Symbols[\ ];数字[0];A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;あ;い;う;え;お;か;き;く;け;こ;さ;し;す;せ;そ ;た;ち;つ;て;と;な;に;ぬ;ね;の;は;ひ;ふ;へ;ほ;ま;み;む;め;も;や;ゆ;よ;ら;り;る;れ;ろ;わ;ん;[ ]
    <$symbols><$numerics><$alphabetics><$kana>
    Then, you need to capitalize the first letter in the bracket used for sorting for every index entry.
    Example:
    Instead of
    画面[hua4mian4]
    specify
    画面[Hua4mian4]
    Now, I'm wondering if there is a way to do a search and replace on all index entries to capitalize the first letter...

  • Default Sort Order for Library View

    It would be fantastic if there were a user defined preference for a default sort order in Library view. For example, some users may prefer to always view the images by File Name, or Rating, etc, without having to change the sort order for each individual folder they view via Lightroom.
    Thanks!

    Thanks for your suggestion Allan, but it doesn't work.
    I'm specifically referring to the defaults that Aperture 3 adopts when you use the "File, Import, Folders as Projects with the projects and albums setting.
    What I'm finding is regardless of the setting in the Library preferences, the default sort order for the project is Date and Manual for the album.
    Yet if I create a project manually the default sort order is as per the Library prefs. Strange.

  • Looking for a way to change sort order for albums

    I know how to set the sort order for each individual song (Sort tab on song info), but is there a way to set sort order for multiple tracks?

    Please help!

  • How to change sort order for Notes in iOS?

    When using Notes in OS 10.10, I can change the sort order. However, I cannot see how to change the sort order for Notes in iOS8 on my iPhone. I sync using iCloud, but the iPhone does not pick up the sort order (alpha) that I have chosen on my MBP.
    Is it possible to change the sort order on phones?
    Thanks.

    View > Sort By > Title

  • How do I change the Sort order for Music Video's on the iPad

    Hi All,
    Apologies if this has been dealt with elsewhere - I can find posts about sort order for TV Shows and Movies but not Music Video's.
    When I sync my music video's the appear in Track order in the video app and I cannot find how to change the sort order to 'by Artist' (or any other order come to that).
    Any ideas please>

    Hi!
    Im afraid I believe this cannot be done yet. Sorry!
    You can try submitting feedback to apple by clicking [here|http://www.apple.com/feedback/ipad.html] if you wish.
    Hope this helps!

  • Default column sort order for 11g table

    Could anyone give me some indication on how I would go about setting the default sort order for a table?
    I have a table with a few columns, and dataset returns in a particular order, but my table decides to sort if in any given order until I manually click on the column header and sort it.
    I would like to have it done by default on a particular field.
    Any info is appreciated.
    Thanks
    Jonny

    As Chris says, the easiest way and best re-use way is to use the order-by clause in your underlying model layer SQL query. For instance in ADF BC this would be in a View Object's query.
    However as you haven't dictated your model layer technology, there is another way in JDev 11g. In your web page that contains the ADF Faces RC table, select the binding tab at the bottom of the page, then double click on the iterator in the binding page, and in the Edit Iterator Binding dialog, select the Sort Criteria tab. This allows you to override the sort order on the iterator's columns.
    CM.

  • Sort Order for Legend and X Axis

    Does anyone know of a way to keep a specific sort order for both the X Axis and the Legend. Both start with numbers and I can get one or the other to sort correcly on the chart but not both. Biggest problem is not all of the legend items are in the first X Axis item so the colors change on the bar graph depending on the legend items in the first X Axis item.

    If you tie bar colors with values, how you will differentiate the bars for different legends.
    Take an example, there are three columns Employee, Location and salery have following values
    Employee Location Salery
    A London 30000
    B Chicago 40000
    C London 50000
    D Chicago 60000
    if we keep Location as Legend and Employee in X Axis, and sort Legend first then Employee. Set Blue for Chicago and Red for London, First two blue bars for A and C will be displayed and then two red bars for B and D will be displayed. Order in X axis will be A,C,B and D. This is not in sequence but this is the way it will and it should work. If you sort by Employee instead if Location, you will get sequence in X axis, but the same colored bars wont be together.
    Thanks
    Swami

  • Control of sort order for asian language navigation

    I am a help writer who is working with both development and a localization vendor to create localized javahelp. I am the most knowledgeable about javahelp, which is not saying much. It has come to me to figure out how to establish the correct sort order for Simplified Chinese and Japanese language Index and Glossary navigators, Could someone explain to me how this is done outside of tools like RoboHelp (which has caused us major headaches yet seems to be the only way the vendor knows how to do JavaHelp). In layman's terms, please.
    thanks,
    ellen

    Same issue here, and the bug syncs to my iPhone, so when I want to quickly text or e-mail someone, their phone numbers and e-mail addresses appear in the wrong order, Work or Home before iPhone or Mobile. How can we get this big fixed in the next Snow Leopard update?

  • Changing Search sort order for Simplified Chinese

    We're generating a Simplified Chinese WebHelp system using Robohelp 10 and we need to change the sort order in the Search results so that it follows the pinyin order instead of "Y, Z, M, T" (Referring to 仪,准,美,通). Is there a way to do this?

    I sort of found a workaround, but it may lead to other problems, so use it at your own risk.
    It also requires a bit of work.
    The idea is to use the sort order for Japanese by specifying the following in the IX reference page.
    Symbols[\ ];数字[0];A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;あ;い;う;え;お;か;き;く;け;こ;さ;し;す;せ;そ ;た;ち;つ;て;と;な;に;ぬ;ね;の;は;ひ;ふ;へ;ほ;ま;み;む;め;も;や;ゆ;よ;ら;り;る;れ;ろ;わ;ん;[ ]
    <$symbols><$numerics><$alphabetics><$kana>
    Then, you need to capitalize the first letter in the bracket used for sorting for every index entry.
    Example:
    Instead of
    画面[hua4mian4]
    specify
    画面[Hua4mian4]
    Now, I'm wondering if there is a way to do a search and replace on all index entries to capitalize the first letter...

  • TA26589 iphone 4s sort order for number in contacts

    iphone 4s How to sort order for numbers in contacts ?
    Like
    First - mobile
    Second - office
    Third - work
    Four - home
    It differs as you enter while as you enter / update.
    Can any one guide me.
    Thanks.

    All you do is hold down on any of the icons for a few seconds and they will start wiggling. You can then move them to your hearts content, either on the same page or to different pages. Just press the HOME button to return to normal mode.
    Glor

  • Sorting TO for group & delivery address

    Folks,
    I have the following scenario:
    I create 1 shipment with multiple deliveries for multiple delivery addresses. Based on this shipment I create a group (VL35_S) and based on the group I create 1 TO. HOw will the sorting on the TO take place? Will it take over the exact sort of the stages in the shipment? So based on the sequence of the deliveries in the shipment, it will create TO items?
    Beside above, the to location is the delivery number. Is it possible to have either the address as to location or have the address printed on the TO?
    Thanks.

    Hi,
       You can create a sort profile in the config. based on which the TO items will be sorted.
    Logistics Execution->Warehouse Management->Activities->Transfer Orders->Define Profile->Sort Profile for TO splitting.
    If that does not suffice the requirement then you can go ahead and sort TO items with in the User-Exit 'MWMTO012' Function Module 'EXIT_SAPLL03A_012'.
    Thanks
    Funky Tech.

  • Specifying alphabetic sort order for other languages.

    The alphabetic sort order differs slightly for other languages then the English one. I rewrite the alphabetics in the special text flow of the Reference Page of the index file, regenerate the index file, but the result is wrong. The special Group Title characters for greek, hungarian, czech, russian etc. languages are combined among latin Group Title characters.
    We work in FM 8 to create 3000 pages technical documentation in 14 languages. The output will be pdf file and help system. Our main problem now the index Group Titles sort order. Could you help me to solve this problem?
    Thank you so much
    Eva

    Michael,
    Thank you so much for your answer. It works great. I have a promlem only one letter, which is in the Czech alphabetics: "Ch". This letter would be after the "H". I have edited the sort order like this:
    Symbols[\ ];Numerics[0];A;B;C;Č;D;E;F;G;H;Chch;I;J;K;L;M;N;O;P;Q;R;Ř;S;Š;T;U;Ú;V;W;X;Y;Z 
    <$symbols><$numerics>Aa Bb Cc *Čč* Dd Ee Ff Gg Hh Chch Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Řř Ss Šš Tt Uu Úú Vv Ww Xx Zz
    The result in the generated index is, that the index entries beginning with Ch comes on below "C" and the GroupTitle "Ch" is disappearing. Take a look at the result in the generated index file, what I am talking about:

  • SORT ORDER WITHIN GROUPS

    Post Author: Kara
    CA Forum: General
    Hi,
    I am using version 9. I have designed a report based on an access control database. It shows a person's time in and time out, then totals these hours. My report is grouped as follows:
    Department
    Date/Time
    Unique ID
    The main data of the report is shown in group footer 3 (Unique ID) and is displayed in numerical order. I need to change the sort order to display by last name, first name but because I have grouped by unique ID I can't seem to be able to do it!
    Any help gratefully received,
    Kara

    Post Author: CoolTowers
    CA Forum: General
    I use a similar report to track service personnel who also have a unique ID.  I have mine set up as follows - maybe this'll help.
    I used selection expert to specify the dates I want to see. 
    Group 1 sorts on the unique ID. Instead of printing the unique ID field in the group header, I have Employee.EmpName.  They'll come out in their unique ID sort so the names might be a little out of order. If that's a problem you could put sort option on that field.
    Group 2 sorts by the Job ID, with the group header suppressed.
    Detail line has location, job id, date, time on, time off, total time in hours and if it's completed.
    Group 2 summarizes at date and amount at the job ID level.
    Group 1 summarizes at technician.
    I get very accurate reports to match against their hand written time cards.
    Perhaps if you re-arranged the grouping?

  • Sorting Order for SAP Tables in DB2 database

    Dear Experts -
    ISSUE: When an ABAP program selects data from the DB into an internal
    table, it is changing the way the data is sorted. In other words, the
    internal table data is in a different sort order than what is in the
    DB. It is not working this way in all other non-production systems
    (DEV, QAS, SAX, etc).
    Temporary solution for the programs that have been identified as
    impacted: Use the ABAP Command 'sort' on the internal table.
    Permanent solution needed : Since it is impossible to identify all
    of the programs that will be impacted, we need PRD to work like DEV,
    QAS, SAX, etc. when selecting data into internal tables. The data
    should be in the same order as it is in the DB (sorted by the key).
    ADDITIONAL INFO: DB2 storage disks crashed a day before. H/W team recovered everything. We are facing this only after the recovery.
    Thanks,
    Dinesh

    can you please check in your code if the sql that is being sent has an order by clause .
    Please let us know the SQL statements that is basically used to fill up the internal table.
    When data is fetched from the database, it is not sorted always. Probably you had a clustered index on the tables and the clustering is not there now.
    Edited by: Ratnajit Dey on Dec 16, 2011 1:56 PM

Maybe you are looking for

  • Using a 160GB Disk with Solaris 8

    Hello all: I am using an Ultra5 system with OBP 3.25.3, Solaris 8 [10/01]. I have a 160GB Seagate ST3160812A disk drive that I am trying to use as a second drive (primary slave). I have installed the drive on the primary channel as a slave and perfor

  • Roadmap of Records Management (RM) & Digital Personnel File (DPF)

    DPF (Digital Personnel File) is SAP standard solution to archiving of process forms and attachments at the end of HCM processes (created by HCM Processes and Forms Framework). I read that until 2012 Record Management (upon which DPF is built) was SAP

  • Stooping a case structure

     Hi everybody.. I want stop the most inner case structure after executing only once but the count is keep on increasing i cannot use STOP...please help Thanks in advavce Attachments: Modified_DiscreteInput..vi ‏27 KB

  • Maintenance Dialog Date Subscreen

    Hi, I have implemented a 2-level-maintenance dialog. I have generated it based on a view, additionally I used the function "time-depended" generation, consequently I got a date subscreen on the detail subscreen. This date subscreen sometimes causes p

  • I have taken episode 4 twice but have not received credit for it. Also, can not open episode 5 to take it\

    I have called the w.w. help desk. Th ey accessed my computer and it see that I completed episode 4 but they could not get saba to accept it and give me credit for it. I can not work on episode 5.