Grouping of numbers

I have data in my table as follows:
ID BONUS
N123 0.005
N123 0.006
N123 0.004
N383 0.004
N383 0.007
N091 0.007
N091 0.008
N091 0.009
I am trying to re-sequence the second field to start with 0.001 for each group of ID(exactly based on the positioning of the decimal number)
In other words, I would like my output to be
N123 0.002
N123 0.003
N123 0.001
N383 0.001
N383 0.002
N091 0.001
N091 0.002
N091 0.003
How can this be done? Thanks

SQL> create table t(ID varchar2(5), BONUS number(5, 3))
  2  /
Table created.
SQL> insert into t values ('N123', 0.005) ;
1 row created.
SQL> insert into t values ('N123', 0.006) ;
1 row created.
SQL> insert into t values ('N123', 0.004) ;
1 row created.
SQL> insert into t values ('N383', 0.004) ;
1 row created.
SQL> insert into t values ('N383', 0.007) ;
1 row created.
SQL> insert into t values ('N091', 0.007) ;
1 row created.
SQL> insert into t values ('N091', 0.008) ;
1 row created.
SQL> insert into t values ('N091', 0.009) ;
1 row created.
SQL> select id, 0.001 * row_number() over (partition by id order by id, bonus) bonus from t ;
ID         BONUS
N091        .001
N091        .002
N091        .003
N123        .001
N123        .002
N123        .003
N383        .001
N383        .002
8 rows selected.
SQL>

Similar Messages

  • How to compare consecutive groups of numbers in arrays

    Hi
    I require to place the solution into a 1D array.
    I need to compare two arrays and save the same numbers that are in both arrays but also save groups of numbers that may be in only one of the two arrays being compared.
    In the example l have not been able to place all consecutive groups of numbers 8,9,10,11,12 into a 1D array.
    In the example l need to filter out the zeros and the number four.
    The numbers in both arrays are always in descending order however may not be in the order of index number of array. That is 15 = 15 index number
    A consecutive group of numbers in this example is a group that increase by a value of 1. E.g.. 8,9,0,22,23,24 are two consecutive groups of numbers.
    Thank  you
    Solved!
    Go to Solution.
    Attachments:
    Compare numbers and consecutive numbers in arrays.vi ‏17 KB

    Hi Lynn
    I did have a look at the consecutive array solution. I have looked and looked l thought l knew how it worked but after a number of separate evaluations with other code l have failed. I am just glad it works. With the consecutive array solution l tried today my own code but l lost either the first number of the last number of a consecutive group of numbers.
    I may have confused you but in doing so you have provided a real different view which l am very grateful. You have viewed the consecutive number problem as just a single 1D array problem. By doing this you have opened my eyes to another way to do the job and a way to handle this type of data. However l am also comparing two arrays. For example l have to pick up say two equal values in two columns that the consecutive array does not detect and then correctly locate a value in the final array if the value is not in the final array.
    What l have not told you is also l have to be able to identify groups of numbers in two 1D arrays. E.g... Array 1 has 1,2,9,10 next array has 9,10 the final array ends up 9,10 when l would like 0,9,10. When viewing numbers by rows later on l can then detect with a array length vi the length of the 1,2 groups of numbers over a large number of columns. If 9,10 jumps to the front it becomes a wrong length. This is actually my main problem which has caused me a large amount of extra programming. I have gone back to basics to see what l can do differently and you have provided the first clue with the consecutive array. I placed it in my main program today and it filtered a lot variable data which l could not remove without losing real data. The main data lost in your solution was the say 17 number in two columns which in an image is a horizontal line. I know what l have just provided you in this paragraph is all new information but it provides a background as to what l am up to. I am getting pixel data from a 2D array and comparing +1 index 1D array with a normal array. This way l can view the data of the next column to see if there is a pattern. I am actually trying to program an array as how humans view objects in images.
    I will have another go at integrating your solution next week
    Regards
    Michael

  • How can I rank a group of numbers in a array or list

    Now I have a group of numbers :13, 4, 5, 10.
    I need a java algorithm to rank those numbers, the result will be like 4,1,2,3 after ranking.
    suppose there are same numbers in the source, for example: 13, 4, 4, 5, 6
    the result will be like 4, 1, 1, 2, 3 after ranking.
    Thank you for any help!

    Another alternative is to make a class which has two attributes
    1. number value
    2. rank
    make this class implement comparable so you sort it anyway you like. Below is a very close example of what you are looking for, just need to replace frequency with rank
    class ComparbleExample{
        private final String[] possibleNumbers = {"one", "two", "three"};
        private String[] inputNumbers = {"one", "two", "three", "one", "one", "four", "three"};
        private Number[] numbers;
        public ComparbleExample(){
            numbers = new Number[possibleNumbers.length];
            populateNumberArrayList();
            System.out.println("\n\nPrinting Unsorted Array");
            print();
            ArrayList<Integer> d;
            Arrays.sort(numbers);
            System.out.println("\n\nPrinting Sorted Array");
            print();
        public void populateNumberArrayList(){
            int frequency;
            for(int i = 0;i<numbers.length;i++){
                frequency = getFrequency(possibleNumbers);
    numbers[i] = new Number(possibleNumbers[i],frequency);
    public int getFrequency(String number){
    int frequency = 0;
    for(int i=0;i<inputNumbers.length;i++){
    if(number.equals(inputNumbers[i])){
    frequency++;
    return frequency;
    public void print(){
    for(int i = 0;i<numbers.length;i++){
    System.out.println(numbers[i]);
    public static void main(String[] args){
    new ComparbleExample();
    class Number implements Comparable{
    private int frequency;
    private String number;
    public Number(String number){
    this(number, -1);
    public Number(String number, int frequency){
    this.number = number;
    this.frequency = frequency;
    public String getNumber() {
    return number;
    public int getFrequency() {
    return frequency;
    public void setFrequency(int frequency) {
    this.frequency = frequency;
    public void setNumber(String number) {
    this.number = number;
    public int compareTo(Object o) {
    Number n = (Number)o;
    if(frequency < n.getFrequency()){
    return 1;
    }else if(frequency > n.getFrequency()){
    return -1;
    }else{
    return 0;
    @Override
    public String toString() {
    return this.number +", "+ this.frequency;

  • Mapping EBS account codes to Group Account Numbers - Customization

    Hi,
    I want to map the account codes that are present in the Oracle EBS to BI Mappings.
    I am aware of the changes to be made to the following three files:
    ■ file_group_acct_names.csv - this file specifies the group account names and their corresponding group account codes.
    ■ file_group_acct_codes_ora.csv - this file maps General Ledger accounts to group account codes.
    ■ file_grpact_fsmt.csv - this file maps Financial Statement Item Codes to group account codes.
    The overview of my case is as flows:
    The client requires the general accounts to be clubbed into different sub-groups based on their reporting practices. This would lead to generation of around 60-70 odd group account numbers. My queries are as follows:
    1.There are cases where accounts belonging to a single parent account needs to be bifurcated into two different group account numbers. In that case, to which group account number should the parent account be classified?
    2.Can we go about modifying the existing group account numbers and adding new group account numbers as long as we are able to categorize them in the existing 6 financial statement buckets?
    3.What are the changes needed to be done in the RPD file to reflect the changes made to the group account numbers? Any documentation highlighting the same would be highly helpful.
    Thanks,
    Regards,
    Rajit

    Hi Krishna,
    I have the same required as yours.
    I implemented the note 914437.
    I noticed two peculiar cases from the standard mapping i.e. (standard BP Role sold to party)
    1) In BP transaction, in Display in BP Role drop down list box there is no custom BP Role as shown above but if I select the detail Icon I can find it there as shown in below screen shot.
    2) I found in Tx BP there is only one BP Role as shown above but in CRM Web UI there are two BP Roles in the ROLEs assignment block.
    Could you please add your comments or solution for it.
    Thanks,
    Raja

  • Most recent date from a colum, group by numbers.

    I want to get the most recent 3 dates from a colum group by account numbers.
    for a account number what are my 3 recent dates. i only need to see the 3 recent dates. for e.g
    Account_number DATE
    1011001002117010     010607
    1011001002117010     010507
    1011001002117010     300307
    1011001002117010     010307
    1011001009077015     010607
    1011001009077015     010507
    1011001009077015     300307
    1011001009077015     010307
    i want to pick up the 3 recent date from the date column
    ( 01/06/07,01/05/07,30/03/07 ) for both the account number.
    Please help me with how do i get that using a select statement.
    Thanks in advance
    ahmed

    Hi,
    Use the following query. This may probably help.
    select account_number, date
    from
    (select account_number, date, row_number() over (partition by account_number order by date desc) rn
    from <your_table_name>)
    where rn <= 3;
    Regards,
    MAK
    Message was edited by:
    user545088

  • Grouping in Numbers

    I have a Numbers file that includes tab with a bar chart, an image, an XY plot and 3 single cell tables (see image below).  It functions great, but on the iPad, it's easy to fat-finger the various elements and move them around accidentally.  I know the doc states these elements cannot be grouped together in the iOS version of Numbers, but are there any other tricks to avoid this behavior? 
    The Annual Sales Volume is actually a slider that drives the bar chart, speedometer needle and odometer number.
    Thanks,
    Lisa

    Make another column that has the division to figure out what week that row belongs to. A summary table to sum/count/whatever by each week as its row header. Graph off of that. Its basically the manual way of creating a small pivot table from excel.
    Hope that helps some,
    Jason

  • Financial Analytics (Map GL natural account to group account numbers )

    Hi All,
    In configuring Financial Analytics file_group_acct_codes_ora.csv file to map oracle general ledger natural account to group account number, It is mentioned that a range of accounts can be grouped as EX:
    Chart Of Aaccount ID=1 FROM ACCT=101010 TO ACCT=101099 Group_ACCT_NUM= CA
    on what basis we need to decide what range of accounts can we grouped as CA/ FG INV/ AP / AR etc. Are there any ERP tables that holds these information.
    Thank you

    No, this is not in the ERP.Usually the FInance analyst or Business Process Owner will be able to provide the info

  • My serial number has only six groups of numbers and won't activate

    my serial number doesn't work

    Hi MimiBaker,
    Which software are you trying to install and on what OS.
    Please send me the serial number so that I can check and validate.
    Send me a private message. Do not post it here.
    If you dont know how to do that refer : http://forums.adobe.com/thread/1184148

  • My daughter cannot remember her passcode for her iPhone 5. She needs a phone number that is stored in the phone and cannot remember her passcode. we have tried many groups of numbers and now we are locked out for an hour each time we put in the wrong pass

    My daughter is out of the country until May. She did not take her iPhone 5 with her. Now she needs a phone number that is stored
    in the memory and cannot remember her passcode. I have tried all of the possibities that she e-mailed , but none of them work
    and now I am locked out for an hour each time I enter an invalid passcode. Help? How can I get around this to access the phone?

    Follow the instructions at http://support.apple.com/kb/HT1212

  • Can you create groups on ipad numbers

    Is it possible to have rows grouped in numbers for IPad?
    I would like to do the following
    Customer 1
    Subdata 1
    Subdata 2
    Subdata 3
    Customer 2
    Subdata 1
    Subdata 2
    Customer 3
    Subdata 1
    Subdata 2
    Subdata 3
    Subdata 4
    Customer 4
    Subdata 1

    It should be something that you are able to do on the iPad, but you can't. Why, I don't know. That feature has been missing from iOS forever.
    There are a couple of third party apps that I know of .... But do not use myself ... That will let you creat groups and email to those groups, which you can't do with the built in mail app either.
    MailShot and Group Email with Attachments are the apps that you can look at.
    If you want to add your name to the list of those that would like to see the ability to do this in iOS .....
    http://www.apple.com/feedback/ipad.html

  • Re-numbering the Group Number

    I have included Special Field "Group Number" in my report which comes up as 1, 2, 3, etc.
    However, I need the group numbers as A), B), C), etc. I tried creating a formula (IF-THEN-ELSE) but I cannot see the Group Number field for selection.
    Q1. Are special fields not available to be included in other formulae?
    Q2. How do I achieve this group re-numbering?
    Thanks,
    Ajay Audich

    Hi Jason,
    Thanks for dot-rpt. It helped me understand.
    What you have done is basically created a formula for the groups. I am using available field in the table "Item Group" as a grouping in my report and then used the ready-made Special field "Group Number" which gives me 1, 2, 3, and so on.
    If I use your logic, I will have to create a formula for groupng instead of using the table field Item Group for grouping. In other words, I will have to create a formula IF Item Group=Group1 then "A)" and so on.
    The problem with this solution is that not all Item Groups appear on my report. My report groups are then numbered as A) followed by D) and so on because of missing Item Groups B) and C).
    Any solution that will work must somehow refer to the special field Group Number - otherwise it looks like it may not work.
    Any ideas?
    THANKS.

  • How to display page numbers based on group

    Hi All,
    I have a report and it consists two groups. First group is displaying 20 pages and the second group is displaying 30 pages. My requirement is to display the page numbers based on the group. That is, the second group output page numbers should start with 1 after displaying first group output. So, the page numbers should be as followed in the report output:
    First group page numbers:
    Page 1 of 20
    Page 2 of 20
    Page 20 of 20
    Second group page numbers:
    Page 1 of 30
    Page 2 of 30
    Page 30 of 30
    How do I achieve the above requirement.
    Thanks in advance.

    When you set the source to "Page Number" for a displayed field, an extra attribute appears on the property palette of "Page Numbering". If you click on this you'll see that you can cause it to reset on a group.

  • Multiple Contacts into a group?

    I would like to create a "group" contact of 9 members who are also individual contacts in the iphone. I want to be able to just click one entry in the contact list to send text messages to. Any ideas on how to do this? I tried to just add all of the individual phone numbers, but then when I want to sent a text, I still need to enter each number from that "group" contact.

    Once you have sent the first SMS to a group of people, it will remain in your message list as a sent message
    To send another one to the same group you just select that group again and type your message.
    It will go to the same group of numbers
    In summary, you select the group from the SMS app, not the Contacts app

  • Group Account Configuration - OBIA 11.1.1.7.1

    Hello,
    I am setting up Financial Analytics OBIA 11.1.1.7.1, have following questions regarding group account code setup
    1. Should we always use Natural Account Segment for mapping to Group Account Codes? I could see a customer is using different segment (Sub Account) to classify their accounts to various categories. Should we use combination of Natural Account and Sub Account to classify them in to various Oracle supplied group account numbers?
    2.If i have to go with multiple segments for group account configuration, i could n't see a technical note from oracle support for OBIA 11.1.1.7.1 where ETL tool is ODI. Can we customize ODI using the technote available for Informatica based OBIA 7964 tech note? Are there any changes to apply on top of it?
    Thanks
    Venkat G

    Hi,
    Thanks for reply. We've multiple COAs(Three Companies with seperate COA) Also with in one COA natural Account is dependend on Sub GL Segment and Cost Center. In "file_group_acct_codes_ora" file we only map Natural Accounts.Now if we map only Natural Accounts to Group Account Number it will pull all data. e.g. Natural Account 123,Cost Center A and Sub GL Account 1 should be mapped to Cash. if we map 123 to Cash it will pull all data for all Sub GL Accounts and Cost Centers. Please let me know if you need more clarification.
    Regards
    mzai

  • Flash 2D Column not grouping data points

    I am trying to use a Flash column chart to display 3 data columns (Planned, Scheduled, Completed) by Month. It works fine as a stacked bar, but when I try to do it as a bar, expecting to see the 3 columns for each month of my schedule, I have problems. Instead of seeing 3 columns for each month, it tries to display 21 columns (3 columns * 7 months) for each month. If I choose to "Show Legend", I get the 3 column titles displayed 7 times for a total of 21 Legend items. I went to the AnyChart website and found documentation. However, it has not helped me. Everything in the documentation relates to XML settings. I tried using custom XML and including the XML settings that the documentation said was necessary to group the numbers by series, but it didn't help. Is there no documentation for the APEX implementation of AnyChart?
    Here is the code for one of the series: select null as link, 'March',
    (select(select sum(w2.TMW_TARGET_PAYORS)
      from tulsa_migration_weeks w2
      where to_char(w2.tmw_week_begin, 'mm')= '03')-
    (select count(x.payor_xref_tul_int_bundle_id) 
    from payor_xref x join
            tulsa_int_sol_bundles b2 on
               x.PAYOR_XREF_TUL_INT_BUNDLE_ID =
               B2.TULSA_INT_BUNDLE_ID
    where X.PAYOR_XREF_TUL_INT_BUNDLE_ID is not null
           and b2.tulsa_int_bundle_target_date is not null
           and to_char(b2.tulsa_int_bundle_target_date, 'mm') = '03')-
    (select count(x.payor_xref_tul_int_bundle_id)
      from payor_xref x join
            tulsa_int_sol_bundles b2 on
               x.PAYOR_XREF_TUL_INT_BUNDLE_ID =
               B2.TULSA_INT_BUNDLE_ID
    where X.PAYOR_XREF_TUL_INT_BUNDLE_ID is not null
           and b2.tulsa_int_bundle_comp_date is not null
           and to_char(b2.tulsa_int_bundle_comp_date, 'mm') = '03'
    from dual) as "Planned",
    ((select count(x.payor_xref_tul_int_bundle_id) 
    from payor_xref x join
            tulsa_int_sol_bundles b2 on
               x.PAYOR_XREF_TUL_INT_BUNDLE_ID =
               B2.TULSA_INT_BUNDLE_ID
    where X.PAYOR_XREF_TUL_INT_BUNDLE_ID is not null
           and b2.tulsa_int_bundle_target_date is not null
           and to_char(b2.tulsa_int_bundle_target_date, 'mm') = '03')-
    (select count(x.payor_xref_tul_int_bundle_id)
      from payor_xref x join
            tulsa_int_sol_bundles b2 on
               x.PAYOR_XREF_TUL_INT_BUNDLE_ID =
               B2.TULSA_INT_BUNDLE_ID
    where X.PAYOR_XREF_TUL_INT_BUNDLE_ID is not null
           and b2.tulsa_int_bundle_comp_date is not null
           and to_char(b2.tulsa_int_bundle_comp_date, 'mm') = '03'
    ) as "Sched-Not Compl",
    (select count(x.payor_xref_tul_int_bundle_id)
      from payor_xref x join
            tulsa_int_sol_bundles b2 on
               x.PAYOR_XREF_TUL_INT_BUNDLE_ID =
               B2.TULSA_INT_BUNDLE_ID
    where X.PAYOR_XREF_TUL_INT_BUNDLE_ID is not null
           and b2.tulsa_int_bundle_comp_date is not null
           and to_char(b2.tulsa_int_bundle_comp_date, 'mm') = '03'
    ) as "Completed"
    from dualThe custom XML I have tried looks like this... <?xml version = "1.0" encoding="utf-8" standalone = "yes"?>
    <root>
      <type>
        <chart type="3DColumn" plot_type="CategorizedBySeriesVertical">
          <animation enabled="yes" appearance="size" speed="10"  />
          <data_plot_settings default_series_type="Bar">
    - <bar_series>
    - <!--  Enabling data-labels and format them as categories names as we want to show managers' names 
      -->
    - <label_settings enabled="true">
      <position anchor="XAxis" />
      <format>{%CategoryName}</format>
      <background enabled="false" />
      <font bold="False" />
      </label_settings>
      <tooltip_settings enabled="True" />
      </bar_series>
      </data_plot_settings>
          <hints auto_size="yes">
            <text><![CDATA[{NAME}, {VALUE}]]></text>
            <font type="Verdana" size="10" color="0x000000" />
          </hints>
          <names show="no"/>
          <values show="no" prefix="" postfix="" decimal_separator="." thousand_separator="," decimal_places="0" />
          <arguments show="no" />
          <column_chart column_space="3" block_space="12">
            <border enabled="no" />
            <block_names enabled="yes" placement="chart" position="bottom" >
              <font type="Verdana" size="10" color="0x000000" />
            </block_names>
          </column_chart>
        </chart>
        <workspace>
          <background enabled="yes" type="gradient" gradient_type="linear">
            <colors>
              <color>0x6699FF</color>
              <color>0xFFFFFF</color>
            </colors>
            <alphas>
              <alpha>100</alpha>
              <alpha>100</alpha>
            </alphas>
            <ratios>
              <ratio>0</ratio>
              <ratio>0xFF</ratio>
            </ratios>
            <matrix r=".785385"/>
          </background>
          <base_area enabled="no" />
          <chart_area enabled="yes" x="80" y="50" width="580" height="230" deep="0">
            <background enabled="no"/>
            <border enabled="yes" size="1"/>
          </chart_area>
          <x_axis name="Month" smart="yes" position="center_bottom" >
            <font type="Verdana" size="14" color="0x000000" bold="no" align="center" />
          </x_axis>
          <y_axis name="Migrations" smart="yes" position="left_center" >
            <font type="Verdana" size="14" color="0x000000" bold="no" align="center" />
          </y_axis>
          <grid>
            <values />
          </grid>
        </workspace>
        <legend enabled="yes" x="680" y="50">
          <names enabled="yes">
            <font type="Verdana" size="10" color="0x000000" />
          </names>
          <values enabled="no"/>
          <scroller enabled="no"/>
          <header enabled="no"/>
          <background alpha="0"/>
        </legend>
      </type>
      #DATA#
    </root>Any help anyone can provide would be greatly appreciated!
    Dale

    Hi Anton,
    I mailed the details ([email protected]) requested from you . Pls help me
    in getting this issue resolved .
    The two queries when run seperately giving proper values and the chart is working fine but when I want to combine this two queries by adding one series for the second query I am having issues in displaying the columns properly .

Maybe you are looking for