Aggregate Function for Text Column???

Hi,
Is there a way to group a column's values appearing in multiple rows ( all having some similarity) to be grouped into one single column in one Single Row??
To be more precise,
do we have an Aggregate function which would group values ( may be using commas for separation) for a single column appearing in multiple rows when "grouped By" on some condition.

See here:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
Rgds.

Similar Messages

  • Aggregate functions for internal table.

    Hi Gurus,
    I'm just wondering whether we can use aggregate functions for internal table. I wanted to know the max value for a particular column in my internal table. How can I achieve this easily and quickly.
    Thanks,
    David.

    sort the table on which you want the maximum value and read it. Please find below example code.
    TYPES : BEGIN OF ty_mvke,
            matnr TYPE mvke-matnr,
            vkorg TYPE mvke-vkorg,
            vtweg TYPE mvke-vtweg,
           AUMNG type mvke-AUMNG,
            END OF ty_mvke.
    DATA : wa_mvke TYPE ty_mvke,
           it_mvke TYPE STANDARD TABLE OF ty_mvke.
    data : temp_AUMNG type AUMNG.
    START-OF-SELECTION.
      SELECT matnr vkorg vtweg AUMNG FROM mvke INTO
            table it_mvke.
    sort it_mvke by AUMNG.
    read TABLE it_mvke into wa_mvke INDEX 1.
    if sy-subrc = 0.
    move wa_mvke-AUMNG to temp_AUMNG.
    write : temp_AUMNG.
    endif.
    Thanks,
    Sreekala.

  • Pivot table in BI Publisher: Different aggregate functions in data columns

    Hi, everyone!
    I`ve got some troubles with pivot table in my rtf-template.
    Here is my xml:
    <ROWSET>
         <ROW>
              <_BI_SUBRF_MO_._MUN_NAME_>МО Петроградский р-н</_BI_SUBRF_MO_._MUN_NAME_>
              <_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>714000003</_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>
              <_BI_MONTH_DEBET_._BI_DEBET_SUM_>0.0</_BI_MONTH_DEBET_._BI_DEBET_SUM_>
              <_BI_CALENDAR_._YEAR__>2009</_BI_CALENDAR_._YEAR__>
              <_BI_CALENDAR_._MONTH__>8</_BI_CALENDAR_._MONTH__>
         </ROW>
         <ROW>
              <_BI_SUBRF_MO_._MUN_NAME_>МО Петроградский р-н</_BI_SUBRF_MO_._MUN_NAME_>
              <_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>714000004</_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>
              <_BI_MONTH_DEBET_._BI_DEBET_SUM_>165.58</_BI_MONTH_DEBET_._BI_DEBET_SUM_>
              <_BI_CALENDAR_._YEAR__>2009</_BI_CALENDAR_._YEAR__>
              <_BI_CALENDAR_._MONTH__>7</_BI_CALENDAR_._MONTH__>
         </ROW>
         <ROW>
              <_BI_SUBRF_MO_._MUN_NAME_>МО Петроградский р-н</_BI_SUBRF_MO_._MUN_NAME_>
              <_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>714000004</_BI_PERS_ACCOUNT_CARD_._BI_PAC_NMB_>
              <_BI_MONTH_DEBET_._BI_DEBET_SUM_>165.58</_BI_MONTH_DEBET_._BI_DEBET_SUM_>
              <_BI_CALENDAR_._YEAR__>2009</_BI_CALENDAR_._YEAR__>
              <_BI_CALENDAR_._MONTH__>7</_BI_CALENDAR_._MONTH__>
         </ROW>
    ...... and so on..
    </ROWSET>
    In the pivot table i`d like to see one row for every BISUBRF_MO_._MUN_NAME_ using BICALENDAR_._YEAR__ and BICALENDAR_._MONTH__ as measures and sum of BIMONTH_DEBET_._BI_DEBET_SUM_ and count of unique (or at least just count of) BIPERS_ACCOUNT_CARD_._BI_PAC_NMB_ in cells.
    I create a pivot table using wizard, everything ok except one thing: as i understand, in pivot table for data in rows we can use only one kind of aggregate function e.g. only sum or only count.
    Is there any way to use different aggregate functions in data cells?
    Thank you

    As you can see, when we use crosstab tag we can specify only one aggregate function for data cells.
    Is there any way to get in XSL-FO (where we can what really happens) instead of:
    <T1>
    <xsl:value-of select="sum(current-group()/_BI_PERS_ACCOUNT_CARD_._BI_PAC_UNID_)"/>
    </T1>
    <T2>
    <xsl:value-of select="sum(current-group()/_BI_MONTH_DEBET_._BI_DEBET_SUM_)"/>
    </T2>
    this
    <T1>
    <xsl:value-of select="sum(current-group()/_BI_PERS_ACCOUNT_CARD_._BI_PAC_UNID_)"/>
    </T1>
    <T2>
    <xsl:value-of select="count(current-group()/_BI_MONTH_DEBET_._BI_DEBET_SUM_)"/>
    </T2>
    Edited by: user12115038 on 26.10.2009 8:08

  • Aggregate function for a report that has sets

    My report combines similar analysis into sets. I need to apply aggregate function such as Max() to the resulting columns. I tried but Analytics doesn't like that. Can someone tell me if this is supported or not? If not, what would be a workaround?

    Have you tried placing the results into a pivot table then assigning this to display MAX results

  • Sorting a Collection with dynamic columns using a custom compare function for multiple columns

    I need help and ideas on how to sort a ListCollectionView.  My problem is complicated by 3 requirements-
         1. The column values contain HTML tags that needs to be removed before sorting (use custom compareFunction to strip HTML)
         2. The columns are dynamic, so dataField names are not known at compile time (need a single compareFunction for all columns)
         3. The data is used in an AdvancedDataGrid so multi-column sorting is required
    I have figured out how to solve any 2 of the 3 requirements.  However, I am having difficulties supporting all 3 requirements.
    Any help or ideas would be greatly appreciated.  Thanks.

    After playing with this some more I think I've figured out a solution.  This seems to work in initial testing.  Also, there is not a need to capture the current sort column in the headerRelease event which many offered solutions suggested.  Another benefit to this solution is that keyboard initiated sorting is handled also.  Whereas the headerRelease event is only triggered by a mouse click on the column header and special handling is required if the user uses the keyboard to access the column header.
    One point that I don't understand is how ascending/decending order is determined.  Behavior seems to be different between a single SortField versus multiple SortFields.  Notice how the compareResults are handled for the different situations.  Anyone out there know why???
     private function colSortCompareFunction(obj1:Object, obj2:Object, fields:Array = null):int{
         var compareResults:int = 0; 
         var newObj1:Object = new Object(); 
         var newObj2:Object = new Object();
          // should not be a condition that is met   
         if (_dataProviderDetails.sort.fields == null)     {
              var s:Sort = new Sort(); 
              var f:Function = s.compareFunction; 
              return f.call(null, obj1, obj2, fields);     }
         // when a single column is selected for sorting   
         else if (_dataProviderDetails.sort.fields.length == 1)     {
              var firstFld:SortField = _dataProviderDetails.sort.fields[0];
              newObj1[firstFld.name] = stripHTML(obj1[firstFld.name]as String);          newObj2[firstFld.name] = stripHTML(obj2[firstFld.name]
    as String);
              compareResults = ObjectUtil.compare(newObj1[firstFld.name], newObj2[firstFld.name]);
               return compareResults;     }
         // when multiple columns are selected for sorting   
         else       {
              for each (var fld:SortField in _dataProviderDetails.sort.fields)          {
                   newObj1[fld.name] = stripHTML(obj1[fld.name]
    as String);               newObj2[fld.name] = stripHTML(obj2[fld.name]
    as String);
                   compareResults = ObjectUtil.compare(newObj1[fld.name], newObj2[fld.name]);
                    if (compareResults != 0)               {
                        if (fld.descending)                    {
                             return compareResults * -1;                    }
                        else                      {
                             return compareResults;                    }
               return compareResults;     }
    Does anyone see any problems with this solution?
    NOTE:  stripHTML(String) is a simple function using regular expression to remove HTML tags.
    Thx

  • SUM function for a column made 'on the fly'

    I have access to a database, however only SELECT statements can be run on the database. Basically the database lists switches, these switches can have up to 20 computers connected to them but some do not. I need to know the switches which contail less than 20 computers so I know where there is space for more computers (I've wrote the code for this already). I also need something to keep a tally/total for the number of spare spaces left so I can run the script and go 'ok we have a total of 20 spare places for computers theres 10 on this switch and 10 on this one'.
    I just need to get the sum funtion working for the column that I've created 'on the fly', the column revealing the number of spare slots, heres the code I've got so far:
    SELECT switch, COUNT(*) as "Servers", 20 - COUNT(*) as "Spare slots"
    from dedicated_servers
    where switch like 'rs%'
    GROUP by switch
    HAVING COUNT(switch) < 20
    order by Servers;
    Which gives the following:
    | switch | Servers | Spare slots |
    | rsj14-1.dc | 12 | 8 |
    | rsj12-1.dc | 15 | 5 |
    | rsi2-2.dc | 16 | 4 |
    | rsj13-1.dc | 16 | 4 |
    | rsi2-1.dc | 16 | 4 |
    Just need something at the end saying TOTAL=25

    OK I'll have to make em up though, but they are something like this for one switch:
    INSERT INTO dedicated_servers (switch, server_number, switch_socket)
    VALUES (rsj-1.dc, 100, 18)
    On switch rsj-1.dc there can be upto 20 servers (the server_number is the primary key)
    Message was edited by:
    slowpoke115

  • Instr function for table column

    hi,
    lets consider the basic soctt.emp table. i need to check for the first occurence of 'a' in the Ename column in emp table.
    select instr(ename,'a') from empabove function does not seem to work
    Please advise.
    Regards

    Hi,
    sri wrote:
    but how would be the query if we have ,(comma) in place of 'A'.
    select instr(ename , ',') from empwill this work.What happens when you try it?
    If it's not doing what you want, then post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Dplain how you get those results from that data.
    If you can show the problem using commonly available tables (such as those in the scott or hr schemas) then you don't need to post any sample data, just the results and explanation.
    Always say which version of Oracle you're using.

  • MDX AGGREGATE FUNCTION FOR UNIVERSE DESIGNER

    Hallo Friends,
    I'm trying to get the summatory of a meassure in Universe Designer for a certain period of time, and I think I can make it with the function AGGREGATE MDX but it always results in an error, I've tried to make it in some different ways but I have again an error. Could somebody please help me with an example of this function in Universe Designer.
    Thanks in advance!

    Hi,
    It's probably (definitely) easier to do this in the Bex layer, but here are some useful samples for you to digest:
    https://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/c0a45246-ce76-2b10-e688-f5c8206203eb&overridelayout=true
    regards,
    H

  • Z10 functionality for text messaging

    I have been used to clicking on a number and then deciding whether  I want to call or text that person. It now appear I have to go into the text messages function and select a contact . Is there a way to click on numbers and decide the function required as in previous models

    Do you mean from the phone app or from the Hub?
    Not that I'm aware of.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • Need help with Math functions for text-based calculator!!!

    I have the calculator working but I am having trouble figuring out thow to do a square root function, nth factorial, absolute value, and Fibonacci. Basically i got the easy part done. Also I am using the case to do the funtions but I am not sure if there are symbols on the keyboard that are commonly used for these funtions so i just made some up. I am new to java and this is only my second assignment so any help would be appreciated. Thanks
    import java.util.*;
    import java.math.*;
    public class calculator
    static Scanner console=new Scanner(System.in);
    public static void main(String[]args)
    double num1=0,num2=0;
    double result=0;
    char expression;
    char operation;
    String Soperation;
    System.out.println("Enter ? for help or enter the operation in which to be processed");
    Soperation=console.next();
    operation = Soperation.charAt(0);
    switch(operation)
    case '+':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1+num2;
    break;
    case'-':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1-num2;
    break;
    case'*':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1*num2;
    break;
    case'/':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    if(num2==0)
    System.out.println("Cannot Divide by Zero");
    result=num1/num2;
    break;
    //square root
    case'^':
    System.out.println("Please enter a number");
    break;
    //fibonacci     
    case'#':
    System.out.println("Please enter the position of the Fibonacci number");
    break;
    //factorial
    case'!':
    System.out.println("Please enter the number for factoring");
    break;
              //absolute value
    case'&':
    System.out.println("Please enter a number");
    num1=console.nextInt();
    result=num1;
    break;
         // help funtion
    case'?':
    System.out.println("Type + for addition, - for subtraction");
    System.out.println("* for multipliction, / for division,^ for the square root");
    System.out.println(" & for absolute value, # for fibonacci,and ! for factorial");
    break;
    System.out.println("The result is:"+result);     
    }

    rmabrey wrote:
    I have the calculator working but I am having trouble figuring out thow to do a square root function, nth factorial, absolute value, and Fibonacci. java.lang.Math.sqrt()
    nothing for factorial - write your own.
    java.lang.Math.abs()
    nothing for Fibonacci - write your own.
    %

  • Average Function for Timestemp Columns

    HI
    Tab_A have two timestemp columns Send_Time and Receipt_Time
    To find the difference of two columns I do (Receipt_Time - Send_Time) as 3rd_Col
    I wish to find average of this 3rd_Col in seconds i.e. avg (Send_Time - Receipt_Time)
    Please advise how?
    Wishes
    Jawad

    Hi,
    Use Average clause with group by.
    Need any more clarification, post your sql query, sample input and sample output
    Regards

  • Functions in a Column

    If I am working on a function for a column, eg =IF(ISBLANK(D11),0,1) , but I want to apply it so that each cell auto updates to the same row as the column (the formula is in column E and I want E11 to look at D11, E12 to look at D12, etc) how do I do that
    without having to copy and paste to each cell and changing the numbers?  Sorry for the noob question, but I'm stumped

    Select the cell with the formula (E11).
    Do one of the following:
    The lower right corner of the selected cell is a small square, the so-called fill handle. Use the mouse to drag the fill handle down to the cells below. This is called 'filling down'. Excel will automatically adjust the reference to cell D11 to D12, D13,
    etc.
    Or copy E11 to the clipboard (Ctrl+C), then select the cells below, e.g. E12:E49. Paste (Ctrl+V) will copy the formula and adjust it automatically.
    A cell reference such as D11 is called relative. Excel will adjust it when you fill or copy it.
    If you don't want the reference to change, make it absolute by inserting $ before the column letter and/or row number: $D$11 will
    not be adjusted. An easy way to make a reference absolute is to select it and press F4. F4 actually toggles between four states: D11, $D$11, D$11 and $D11.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • PL/SQL : User defined Aggregate Functions ??

    Is it possible to create (using whatever language) a user defined aggregate function for transparent usage within sql ?
    e.g.
    select median(myField) from myTable
    or
    select empirical_expectation(myField) from myTable
    thanx in advance ..
    Tobias Oberstein

    HI,
    U can create a stored proc. (PL/SQL) for this and call as any other function.
    By using external procedure, U can create shared library in C or C++ and coonect this shared library by using external function/procedure. This will be become user-defined procedure.
    with regards,
    Boby Jose Thekkanath.

  • Max function for table having no rows

    Hi All
    I have a table in which initially no rows. I am running max() function for a column and then wnats to add 1.
    But when no rows there below code in not working
    select max(code) into p_maxCode from cms_codedetails where codetypeid=0;
    p_maxCode:=p_maxCode+1;
    dbms_output.PUT_LINE('p_maxCode: '||p_maxCode);
    result is:
    p_maxCode:
    How can I handle the this to get 1 if no rows in the table .

    Hi !
    Max function in yur case returns NULL and then
    null + <anything> ... is still null
    You can do
    p_maxCode:=nvl(p_maxCode,0)+1;
    or
    select nvl(max(code),0) into p_maxCode from cms_codedetails where codetypeid=0;
    Of course if YOU have decide that null in this case can be treated as 0
    T

  • ORA-24347: Warning of a NULL column in an aggregate function

    The following query works fine, normally.
    select max(ship_date) Ship_date,msn.attribute7 from
         mtl_serial_numbers msn,
         mtl_item_categories mic,
         mtl_categories mc
                   where      msn.inventory_item_id = mic.inventory_item_id and
                   mic.category_id=mc.category_id and
                   mic.category_set_id=1 and
              mc.segment1 in ('ILMI','ILM','ILMI-UNT')
              Group by msn.attribute7
    But when I include the same query inside a SQL report it gives me the Following error message
    ORA-24347: Warning of a NULL column in an aggregate function
    Help me out.

    I tried out with some Dummy Date, it worked fine.
    But the problem I am facing here is I cannot assume
    any Date for the corresponding column. Whether there
    is any other possibility to avoid this problem without
    giving any dummy date?
    thanks,
    chandru

Maybe you are looking for

  • IPod Nano 7th gen wont turn on after a restore

    I tried holding down the top and middle buttons and it wont work, this is a replacement one for an iPod Nano 7th gen with corrupted software, could it be the same problem? During the restore it says it's restored and not to disconnect my iPod but the

  • Tcode or table to view the details of user

    Hello Experts Can anybody tell the TCode or Table which tells the details of user with the report used by them on last used date. Thanks in Advance Neha

  • User not displaying in Hyperion Planning 11.1.1.3

    Hi All, i have create users in Shared Services and assign provison on Planning application. after this i log in to planing when i m trying to assign access on perticuler dimention Assign Access>>add Access under this user and group tab user is not di

  • Creating service contract from OM

    Hi, We have tried creating service contracts from OM in 11.5.10. Can we create service contracts from OM in 11.5.9? Any pointers where i can confirm this? Thanks, Sid.

  • Private messaging?

    Is there a way to send a private message to another user here? I don't see one, though it's unusual for that to not be available these days on message boards. Assuming PM isn't implemented here, I suggest that it be added. Among other things, it's al