Group by range

Hi friends
In one of report i have to group by some range.for ex
I have to show the no of students and the total marks in a report for less<100 marks then marks>100 and <200 and like wise
no of accts totalmarks
1.upto 100
2over 100 and less than 200
how the above result can be achieved by simple sql
Thanks in advance

Hi,
dj wrote:
thanks for quick reply but case statement will give me the result in a single row if I am not wrong, but i want the result in tabular form.I showed how to group rows into ranges. You can then do whatever you want to with that range value. For example, you can use the range value to pivot the results into a tabular form.
Please post some sample data (CREATE TABLE and INSERT statments) and the exact results you want from that data, formatted and posted between \ tags.
Explain how you get those results.  In particular, explain how ranges are determined.
Say which version of Oracle you have.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Customer Account Group Number Range

    Hi Guru's,
    The Customer Account Group Number Range has currently taking 10 digits. But my client wants to be 12 digits.
    Could you please guide me, to do the necessary setting for the same.
    Kindly suggest.
    thanking you,
    regards,
    Sreeni

    Dear Sreeni,
    You can't change standard customer no range flied width.
    You can create a new ZTABLE with 12digits.
    regards
    natraj

  • Reg: Vendor Account Group Number Range

    Hi Guru's,
      I have created 3 Account groups for vendor -
    MV- Material Vendor , SV - Service Vendor , Ov - One Time Vendor
    And i need to number range (external) like this for MV- MV10000 to MV19999 and SV - SV10000 to SV19999
    i tried by XKN1 but the system says Enter the intervals without overlap .
    Guide me to achieve this.
    Thanks in advance
    Regards
    Anand

    Hi
    Thanks for your solution.. It means my intervals falls under a to zzzz.
    i have a query A to  ZZZZZ is alphanumeric or alphabetic?
    Can we set the range only as alphabetic .. that is no numeric is allowed .
    Regards
    Anand

  • SSRS Chart grouped by range of values

    Hello,
    Can you guys assist in the following scenario where I have two columns  "Staff"  and  "Age"
    Staff     Age
    John      23
    Bob       25
    Mike      27
    Caren   35
    Bonny   42
    I'm trying to build a Column chart in SSRS 2008 that would Count th number of staff in every age range (20's , 30's, 40's)
    I'm hoping to get three columns in the chart : one field for the 20's  with 3 people in it;    and two other columns for the 30's and 40's with one staff in each.
    I can't figure out the expression that should be used in the categories group of the chart.
    thanks in advance

    Thanks Elvis for a gr8 solution, i followed your solution but with that i got another problem,
    please help me to solve this,
    Now my problem is, if Data set bind with chart do not have any row for a particulate category (like "8-14 Days") then chart is not showing data for in with 0 value,
    my requirement is if no data available for a age category Zero value is to be displayed like,
    Please help me on this.. it is urgent for me...

  • Grouping a range of numbers into a like group

    I am trying to group credit scores by risk value.  The data that I'm pulling in is a number an I want to convert it to a letter. 
    So anything over a score of 700 is A credit for example.  Anything between 660 and 699 is B Credit, between 630 and 659 would be C Credit and so on.
    Currently the data comes in from the databas as a string field(dont make sense to me either), the string field is a number anywhere from 0 to 800.  I do understand that I will have to convert the string to a number and then probably a SELECT CASE statement, but I'm lost from there.  My current select case looks like this
    select CDbl({APPLIC_DATA.AP_RISK_SCORE})
        Case Is >= 700:
        "A"
        Case 660 To 699:
        "B"
        Case 630 To 659:
        "C"
        Case 580 To 629:
        "D"
        Case 1 To 579:
        "E"
        Case 0:
        "No Score"
    This is not working for me.  I was thinking that it would change my numbers in this field to the correct letter that corresponds to that number and I could group from there, but that obviously is not what is happening.
    Any help would be appreciated.

    I'm sorry I have one more issue that I discovered here and cant seem to fix.  Some of the fields are blank and have no data so I have tried...
    if tonumber({APPLIC_DATA.AP_RISK_SCORE})>=700 then
    "A"
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE}) in 660 to 699 then
    "B"
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE}) in 630 to 659 then
    "C"
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE}) in 580 to 629 then
    "D"
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE}) in 1 to 579 then
    "E"
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE})=0 then
    "No Score"
    else "No Score"
    Along with other such as:
    else if tonumber({APPLIC_DATA.AP_RISK_SCORE})="" then
    "No Score"
    All with no outcome.  The field just remains blank.  What am I doing wrong here?

  • SAP buffer for Customer Account Group (number range skipping)

    Dear Experts,
    When creating new customer for Account Grp = TRDL for my company, I find out that the number range always skip and this problem continues. Someone told me to check it out if the problem might comes from buffer. In Tcode = SNRO (Object = DEBITOR) I find out that buffer setting = 5.
    The Question is how can I check if this buffer rate is compatible with my SAP environment? or which rate is more compatible and help solve the problem of number range skipping?
    If anybody have some suggestion please feel free to contribute it.
    Thank you very much

    Hi,
    in SNRO, take out the flag for
    "Main memory buffering".
    SAP recommends:
    Dependencies
    When buffering number intervals, gaps may result in number assignment. Buffering is therefore not possible for applications, which require continuous number assignment.
    What happens is that the system loads consecutive numbers into the buffer, in your case these are five consecutive numbers. When you create customers and do not use all the numbers already in the buffer, the numbers remain open. Example: You start XK01 for customer creation, create three customers and then logoff. You have two open numbers remaining. Numerical example: 1, 2, 3 have been used, 4 and 5 have been reserved, but are open.
    When invoking XK01 again after subsequent log-on, the system pulls the next five numbers into the buffer. Since 1,2,3,4,5 were already taken (for the previous buffer), the next buffer goes from 6 to 10.
    Numbers 4 and 5 will never be used, the practical consequence of that are the number gaps that you have noticed.
    Hope this helps.
    Rudolf

  • Group by range of 10 (amount)

    Hi all,
    I have a table of 400,000 records like this:
    But I need grouped by amount of 10 and count the number of clients grouped, something like this:
    I hope the pictures explain better my problem.
    Thanks for your support
    Carlos

    Create a table like this ---
    GroupTens
    Start
    End
    Group
    0
    10
    Group 0 to 10
    11
    20
    Group 11 to 20
    21
    30
    Group 21 to 30
    31
    40
    Group 31 to 40
    41
    50
    Group 41 to 50
    51
    60
    Group 51 to 60
    61
    70
    Group 61 to 70
    71
    80
    Group 71 to 80
    81
    90
    Group 81 to 90
    91
    100
    Group 91 to 100
    101
    110
    Group 101 to 110
    111
    120
    Group 111 to 120
    121
    130
    Group 121 to 130
    131
    140
    Group 131 to 140
    141
    150
    Group 141 to 150
    <tfoot></tfoot>
    Then this query with your table and field names --
    SELECT DISTINCT CarlosDante.Account, (SELECT COUNT([XX].ClientID) FROM CarlosDante AS [XX] WHERE [XX].Account = CarlosDante.Account AND [XX].Amount BETWEEN START AND END) AS ClientCount, (SELECT SUM([XX].Amount) FROM CarlosDante AS [XX] WHERE [XX].Account
    = CarlosDante.Account AND [XX].Amount BETWEEN START AND END) AS SumOfAmount, GroupTens.Group
    FROM CarlosDante, GroupTens
    WHERE ((((SELECT COUNT([XX].ClientID) FROM CarlosDante AS [XX] WHERE [XX].Account = CarlosDante.Account AND [XX].Amount BETWEEN START AND END))>0))
    ORDER BY CarlosDante.Account, GroupTens.Group;
    Build a little, test a little

  • Query help - Group by range of program set

    Need help in developing query with the following set of data.
    Program
    req_id
    parent_id
    runtime
    A
    1
    -1
    30
    A1
    2
    1
    20
    A2
    3
    -1
    1
    A3
    4
    3
    5
    A4
    5
    -1
    7
    A5
    6
    -1
    4
    A6
    7
    -1
    3
    A1
    8
    1
    10
    A2
    9
    -1
    1
    A3
    10
    9
    2
    A4
    11
    -1
    3
    A5
    12
    -1
    2
    A6
    13
    -1
    2
    The results I am looking for is in the following format.
    Set
    G1
    G1_time
    G2
    G2_time
    G3
    G3_time
    Set1
    G1
    6
    G2
    11
    G3
    3
    Set2
    G1
    3
    G2
    5
    G3
    2
    Can you please tell if this can be achieved using sql in Oracle 11g?
    Thanks very much.

    Hi,
    Depending on your requirements:
    WITH   got_grp AS
        SELECT  program
        ,       LAST_VALUE ( CASE
                                 WHEN  program = 'A1'
                                 THEN  req_id
                             END
                             IGNORE NULLS
                           ) OVER ( ORDER BY  req_id ) AS grp
        ,       req_id
        ,       runtime
        FROM    a
    ,   got_c_num    AS
        SELECT  DENSE_RANK () OVER (ORDER BY grp) AS grp_num
        ,       runtime
        ,       CEIL ( ROW_NUMBER () OVER ( PARTITION BY  grp
                                            ORDER BY      req_id
                     / 2
                     )     AS c_num
        FROM    got_grp
        WHERE   program  NOT IN ('A', 'A1')
    SELECT     'SET' || grp_num    AS "SET"
    ,          'G1'                AS g1
    ,          g1_time
    ,          'G2'                AS g2
    ,          g2_time
    ,          'G3'                AS g3
    ,          g3_time
    FROM       got_c_num
    PIVOT     (    SUM (runtime)
              FOR c_num  IN ( 1 AS g1_time
                            , 2 AS g2_time
                            , 3 AS g3_time
    ORDER BY  grp_num
    Output:
    SET        G1    G1_TIME G2    G2_TIME G3    G3_TIME
    SET1       G1          6 G2         11 G3          3
    SET2       G1          3 G2          5 G3          2

  • IP Address Value within a range

    I have this table:
    GROUP_UID
    GROUP_NAME
    IP_VALUE_LOW
    IP_VALUE_HIGH
    It is used to control the grouping of ranges of IP Address. I need help on two things with this table. I am sure the solution to one will lead me to the other.
    1. When given an IP_VALUE I need to return the GROUP_UID/NAME that IP_VALUE falls into. I can not use the normal between IP_VALUE_LOW and IP_VALUE_HIGH becuse the IP Value is not truly consecutive.
    13150400 = 192.168.200.0
    13150402 = 194.168.200.0 not 192.168.200.2
    13150403 = 195.168.200.0 not 192.168.200.3
    13150404 = 196.168.200.0 not 192.168.200.4
    13150405 = 197.168.200.0 not 192.168.200.5
    so 13150403 in not between 13150402 and 13150404
    but 192.168.200.3 is between 192.168.200.2 and 192.168.200.4
    2. A group is added or updated. I need to ensure that two groups do not overlap ranges.
    Any Help would be great!!!

    This is the funtion I use now to convert an IP Address to an IP Value:
    FUNCTION IPAddressToIPValue2 (in_IPADDRESS VARCHAR2)
        return NUMBER
    IS
        v_OCTET4 NUMBER;
        v_OCTET3 NUMBER;
        v_OCTET2 NUMBER;
        v_OCTET1 NUMBER;
        v_IP1 VARCHAR2(20);
        v_IP2 VARCHAR2(20);
        v_IP3 VARCHAR2(20);
        v_IP4 VARCHAR2(20);
    BEGIN
        if length(in_IPADDRESS) > 15 then    
            return -3000000000;
        end if;
        select
            max(decode(portion,1,piece)),
            max(decode(portion,2,piece)),
            max(decode(portion,3,piece)),
            max(decode(portion,4,piece))
        into
            v_IP1,
            v_IP2,
            v_IP3,
            v_IP4
        from (
                select
                    seq portion,
                    substr('.'|| in_IPADDRESS ||'.',instr('.'|| in_IPADDRESS ||'.','.',1,seq)+1,
                    instr('.'|| in_IPADDRESS ||'.','.',1,seq+1) - instr('.'|| in_IPADDRESS ||'.','.',1,seq) - 1) piece
                from (select 1 seq from dual union all select 2 from dual union all select 3 from dual union all select 4 from dual));
                v_OCTET4 := to_number(v_IP4);
                v_OCTET3 := to_number(v_IP3);
                v_OCTET2 := to_number(v_IP2);
                v_OCTET1 := to_number(v_IP1);           
                if v_OCTET1 not between 0 and 255 or v_OCTET2 not between 0 and 255 or v_OCTET3 not between 0 and 255 or v_OCTET4 not between 0 and 255 then
                    return -3000000000;
                else
                     return
                     case
                         when v_OCTET4 < 127 then
                            v_OCTET4 * power(2,24) + v_OCTET3 * power(2,16) + v_OCTET2 * power(2,8) + v_OCTET1
                         else
                            v_OCTET4 * power(2,24) + v_OCTET3 * power(2,16) + v_OCTET2 * power(2,8) + v_OCTET1 - power(2,32)
                     end;          
                end if;
    END IPAddressToIPValue2;would I just:
                     return
                     case
                         when v_OCTET4 < 127 then
                            v_OCTET1 + v_OCTET2 * power(2,8) + v_OCTET3 * power(2,16) + v_OCTET4 * power(2,24)
                         else
                            v_OCTET1 - power(2,32) + v_OCTET2 * power(2,8) + v_OCTET3 * power(2,16) + v_OCTET4 * power(2,24)
                     end;           Message was edited by:
    Chris Wendell

  • Urgent Pl help :Cannot insert Order Group in KONK

    I am not able to insert new Order Group in KONK the number range i select for the Group get added in the number range interval but i can not see any order group which i am trying to insert.
    I have check the transaction SU53 for any authorization object issue but there is no such issue and system is showing the message authorization check was successful.
    Please help its urgent
    points will be awarded

    Hi
    For internal order group number ranges try in T.code: KOT2_OPA
    select the order for which you want to change the number range
    click on change button at the number range, select order group again,
    go to Intervals menu and click on Maintain it will allow you to change the number ranges.
    Regards
    Prasad
    Accenture - Hyd

  • Internal Order Number Ranges & Order Types

    hi,
    i am facing a problem when creating order groups & number ranges it is not appearing in the screen how to over come this problem 
    with regards,
    jayaprakash

    Hi
    Goto TCode KONK
    Select Groups
    Goto Menu Group and select Insert and enter your text and interval number from and to which are not overlapping
    Then Select the newly created Group and put a cursor on the element
    Goto menu Edit and select Assign Element group
    SAVE
    Cheers
    Srinivas

  • Group by time duration

    I'm having an tasktable which has startdate,enddate,activity,subactivity etc.
    Now I have to create a tasks by duration in mins report and group it by duration. I'm a newbee to oracle and I have done grouping by column. I dont know how to group it by range.
    I have to calculate the responsetime=enddate-startdate and
    The final output should be like this:
    select responsetime,activity,subactivity
    from task where responsetime is between the range
    group by range.
    The range being 0-15mins,15-30mins,30-60mins,1-2hrs etc.
    Immediate Response would be appreciated.
    Thanks,
    Puja

    Hi, i guess I think you are looking for this...
    getting the resultset order of response range, if u need the group by you can add the sum function with with an alias name (same in all inner queries) to every inner queries and then....
    HOPW YOU ARE LOOKING FOR THIS..... YOU CAN ADD ANY NUMBER OF REANGER HERE ...
    select * from
    select to_char(enddate-startdate,'sssss') as responsetime,activity,subactivity ,1 as renge
    from task where to_char(enddate-startdate,'sssss') between (1 and 15)
    union
    select to_char(enddate-startdate,'sssss') as responsetime,activity,subactivity ,2 as renge
    from task where to_char(enddate-startdate,'sssss') between (16 and 30)
    union
    select to_char(enddate-startdate,'sssss') as responsetime,activity,subactivity ,3 as renge
    from task where to_char(enddate-startdate,'sssss') between (31 and 60)
    union
    select to_char(enddate-startdate,'sssss') as responsetime,activity,subactivity ,4 as renge
    from task where to_char(enddate-startdate,'sssss') between (61 and 120)
    ) order by range ;
    ALL THE BEST....
    khaleel.

  • PR Approval doesn't work properly in item category ranges

    We are facing anomalous behavior in purchase, we defined approval group based on item category ranges. When user submits PR for approval, it gets second approval as final approval. But actual this item get approve is next approval. When we incomplete this requisition using SQL script and submit it again it act normally and get approved from appropriate person.
    Second approval assigned another approval group but this item category doesn’t fall in approval group category range.
    regards,

    You are posting in the wrong place for this.  You should post in the DSC forum.
    If you have issues with CmdLets or MS software then post you issue in connect.
    https://connect.microsoft.com/
    ¯\_(ツ)_/¯

  • Date Grouping

    Post Author: conrads
    CA Forum: Formula
    I have report that I need to group a range of eligibility records, I would like to display the min start date and max end date for each period of eligibility if there is no status change and no break in consecutive months of coverage. I am using Crystal XI and Oracle 10g. Here is an example of our data: Mem ID Plan ID Start Dt End Dt Status 255099 1917486 10/01/2003 06/30/2004 A 255099 1917493 07/01/2004 03/31/2005 A 255099 1917518 04/01/2005 12/31/2005 A 255099 1917522 01/01/2006 01/31/2006 A 255099 1917526 02/01/2006 06/30/2006 A 255099 1917530 07/01/2006 08/31/2006 H 255099 3359315 12/01/2006 01/31/2007 H 255099 4093936 04/01/2007 12/31/2099 A For the first group I need to display 10/01/2003 as the min start date and 06/30/2006 as the max end date. It should not include the next record of 07/01/2006 to 08/31/2006 since the status changed to "H". Can anyone help me with this?

    Post Author: conrads
    CA Forum: Formula
    Yangster,  This is how I got the first record and last record to show.
    if not onfirstrecord and {@Status Code} = previous({@Status Code})and {@Start Dt} = previous({@End Dt})then "" else totext({@Start Dt});
    if not OnLastRecord and {@Status Code} = next({@Status Code})and {@End Dt} = next({@Start Dt})then "" else totext({@End Date})
    Here is how my data looks and is formatted?
         Mem_id Plan Id     Start Dt         End Dt       Status  Date Begin      Date End
         255099   1917486   10/01/2003    06/30/2004   A       10/01/2003     255099   1917493   07/01/2004    03/31/2005   A     255099   1917518   04/01/2005    12/31/2005   A     255099   1917522   01/01/2006    01/31/2006   A     255099   1917526   02/01/2006    06/30/2006   A                             06/30/2006
         255099   1917530   07/01/2006    08/31/2006   H       07/01/2006     08/31/2006
         255099   3359315   12/01/2006    01/31/2007   H       12/01/2006     01/31/2007
         255099   4050419   04/01/2007    12/31/2099   A       04/01/2007     12/31/2099
    I would like to show the dates between the Date Begin to be the same as the first record of that period and the end dates the same as the max date for that period so it looks something like this:
         255099   1917486   10/01/2003    06/30/2004   A       10/01/2003    06/30/2006     255099   1917493   07/01/2004    03/31/2005   A       10/01/2003    06/30/2006     255099   1917518   04/01/2005    12/31/2005   A       10/01/2003    06/30/2006     255099   1917522   01/01/2006    01/31/2006   A       10/01/2003    06/30/2006     255099   1917526   02/01/2006    06/30/2006   A       10/01/2003    06/30/2006
    This is considered one eligible period since the status is the same and no breaks in consecutive months of covereage. Then I would like to suppress any other period that does not fall between the range of dates via a parameter entered by user.   I am unable to figure out how to do this.
    Thanks

  • Grouping Error Message

    Hi All,
    I am creating a group by
    runing the report, right click object 'Account' and the clicked variables.
    Clicked on 'groups' and then named group 'test'. Highlighted all the values on the left hand side and clicked 'Add', clicked 'ok' and that when there is a triangle and ! appearing...any one any ideas?
    This is a multi-tab report...with one data source...all the tabs are the same apart from they are filtered by country.
    Anyone any ideas?
    Many Thanks

    Hi Venkat,
    You need to tell the application, with grouping/number range will be used to assign a number, to the business partner you are creating.
    If none is indicated, it will get the standard one that is seems you have not defined in your system, and will give that error message.
    You can define the internal standard grouping in following path:
    SPRO->IMG->Cross-Application Components->SAP Business Partner->Business Partner->Basic Settings->Number Ranges and Groupings->Define Groupings and assign number ranges
    Kind regards,
    Garcia

Maybe you are looking for

  • I want to call a variable in another application

    Greetings, I asked previously a similar question but I didn't got a solution to my problem, so i'll explain in details my problem: I have a Java File called Senior.java, and another one called Properties.java Properties.java is a dialog box that I ca

  • Could sombody help me with this panic report?

    Sun Mar 24 18:58:10 2013 Panic(CPU 1): Unresponsive processor (this CPU did not acknowledge interrupts) TLB state:0x0 RAX: 0x00000000ffffffff, RBX: 0x0000000000002710, RCX: 0x0000000000007000, RDX: 0xffffff80f215d078 RSP: 0xffffff80fac0bc1c, RBP: 0xf

  • Displaying image in a frame window using file dialog(using swing) ...

    here is my code....pls try running it... import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class MainMenu3 extends JFrame { BorderLayout layout ; JPanel buttonPanel ; JFileChooser fileChooser ; JButton btn1,bt

  • Multiple Dummy Profit Center

    We have one controlling area and multiple company codes. The requirement is to have 1 dummy profit center per company code. Is that possible? The reason being, currently all company codes are trying to post in one dummy profit center and it becomes h

  • StatelessSession EJB access via JCOM???

    I have successfuly accessed the sample containerManaged EJB using the zeroclient and latebound examples, but now I am trying to access the statelessSession EJB (ejb20-statelessSession-TraderHome) sample using both zeroclient and latebound examples, b