Assign ID to every group of result

Hi all,
I have this problem to assign serial ID to every group of result for my SQL. Let say if I want to group date for 11 data and my result returned 5 groups of date. Is there any way I can create a SQL statement that can assign ID for each group of date without using 'GROUP BY'? Using example count() over total maybe?

Use DENSE_RANK analytic function
with c as
select sysdate DT,1 ID,'VAL1'  VAL FROM DUAL UNION ALL
select sysdate DT,2 ID,'VAL2'  VAL FROM DUAL UNION ALL
select sysdate DT,3 ID,'VAL3'  VAL FROM DUAL UNION ALL
select sysdate-2 DT,4 ID,'VAL4'  VAL FROM DUAL UNION ALL
select sysdate-2 DT,5 ID,'VAL5'  VAL FROM DUAL UNION ALL
select sysdate-4 DT,6 ID,'VAL7'  VAL FROM DUAL UNION ALL
select sysdate-4 DT,7 ID,'VAL6'  VAL FROM DUAL UNION ALL
select sysdate-4 DT,8 ID,'VAL8'  VAL FROM DUAL UNION ALL
select sysdate-5 DT,9 ID,'VAL9'  VAL FROM DUAL )
SELECT DENSE_RANK() OVER (ORDER BY TRUNC(DT) DESC ) RN, DT,ID,VAL
FROM C
        RN DT                ID VAL
         1 13-AUG-10          1 VAL1
         1 13-AUG-10          2 VAL2
         1 13-AUG-10          3 VAL3
         2 11-AUG-10          4 VAL4
         2 11-AUG-10          5 VAL5
         3 09-AUG-10          6 VAL7
         3 09-AUG-10          7 VAL6
         3 09-AUG-10          8 VAL8
         4 08-AUG-10          9 VAL9
9 rows selected.

Similar Messages

  • Assignment of users to groups in portal based on some filter criteria

    Hi All,
    I have some 200 users in portal and the UME is portal database. Now I want to assign 50 users who belong to a specific department to a new group in portal.
    Unfortunately during the assignment of users to groups there is no advanced search option where I can search for the users based on some criteria like department,organisation unit,first name etc. We can only search for the user based on user id or name.
    How can we do a mass assignment of users to groups based on filter?
    Any suggestions / solutions are highly appreciated. Points are rewarded for sure.
    thanks
    Sreeram

    Hi Sreeram,
    three possibilities:
    1.) Develop a small component which does a search based on the criteria you want to use and which then assigns the found users to the group in question. Not really hard, but every development takes some time to develop, some time to test. So if you really want this actione done just once, development may take too long; if the scenario may happen more often, it may make sense to have such a component ready.
    2.) Search for the users based on the criteria you want to use via the portals UI. Copy the result into some wordpad, and assign all results afterwards manually, as you have described. Ugly, but (for a one-time action) faster than 1.).
    3.) Start like 2.), but use the copied result within the wordpad to "import" the group definition via a text file, see http://help.sap.com/saphelp_nw04/helpdata/en/1a/cde2fb82644d98bfb6d558440d6806/frameset.htm and around. Probably the fastest and most efficient way to go!
    Hope it helps
    Detlev

  • Assigning Portal Users to Groups

    Hi,
    Is there a way we can assign portal users to portal groups through a sql or through a form interface? Right now, it is only possible to create users and go into individual groups and assign users to them. If a user should belong to multiple groups, then we need to go into each and every group and assign the user. Instead of this, is it possible to write a query or create a form interface and assign the user to all groups that he belongs to?
    Thanks for your response.

    Dear Hassan,
    Need a clarification. If users are assigned to a group in LDAP, Can you see the same thing reflecting in portal?
    I have configured LDAP as UME and I am able to see a group of LDAP appearing in Portal. But when I see the list of users assigned to this group, its empty.
    Any clues or suggestions.
    Regards,
    Sreeram

  • Transaction of item with cost-group 2008 results in cost-group comingle

    Hi Folks,
    I have the following error on Miscellaneous Transaction when I use a different cost group than the default one assign on subinventory:
    Transaction of item with cost-group 2008 results in cost-group comingle
    In our specific case, we define a CONVERSION subinventory with default Cost Group is X
    We would like to create Miscellaneous Transactions (interface table) which use CONVERSION subinventory with different Cost Group.
    The problem is when we use a Cost Group other than X, the "comingle" error occured.
    Is there a manner to create a Miscellaneous Transactions base on a Cost Group different than the default define in the subinventory?
    Regards

    HI,
    is not that type of error.
    Actually there is no error. the system is working as it should.
    I have used different cost groups in subinventories.
    I need a way to change the cost group for some of the items.
    I found some workaround in article 837816.1 but i'm not able to follow it.
    Pls,
    help with procedure to follow.
    Thank you in advance,
    Denis

  • Human Workflow email notification to a distribution list when assigned to an approval group

    Hi All,
    is there a way to send the notification email to an email distribution list when a task is assigned to an approval group instead of sending individuals emails to each member?
    As of now HW config is sending individual emails to each member of the approval group when the task is assigned to that approval group, for some approval groups (not all) they want the notification emails be sent to a distribution list, also we are using the actionable emails - so far it's working fine - the only thing is that the recipient of the actionable emails should be a dist list, is this even possible?
    thanks in advance

    Hi,
    From your description, some users that are not the dynamic distribution group members receive the messages that are sent to the dynamic distribution groups. If I have misunderstood your concern, please let me know.
    In your case, I recommend you use the following cmdlets to verify the members of this dynamic distribution group at first.
    $MarketingGroup = Get-DynamicDistributionGroup "Marketing Group"
    Get-Recipient -RecipientPreviewFilter $MarketingGroup.RecipientFilter -OrganizationalUnit $MarketingGroup.OrganizationalUnit
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support
    Hi Amy,
    Correct, some users that should and are filtered out from the DDL are receiving the emails.
    I set the variable and ran the command you provided and got consistent results to the "filter preview" in EMC, the particular user that is filtered out in both membership preview method is still receiving these emails!
    Ash

  • Want robust solution for alternating row color, resetting every group

    I would like a solution for displaying an alternating row color for my detail rows that resets every group, so that row 1 is always gray.
    Our Crystal designer provided this code to me:
    @rowcnt formula, suppressed, placed in Detail row:
    Shared numbervar rowcnt;
    rowcnt := rowcnt + 1;
    @resetrowcnt, suppressed, placed in Group row:
    Shared numbervar rowcnt;
    rowcnt := 0;
    Formatting formula, placed in Color in Detail > Section Expert:
    Shared numbervar rowcnt;
    if Remainder(rowcnt, 2) <> 0 then
    color(241,241,241)
    else
    crWhite
    This was working fine for me.
    However, it is suddenly not working in one of my reports.
    The report does happen to have two groups (rowcount.png).
    When the report is run, all rows are colored (rowcount02.png).
    This report was previously working fine!  I'm not sure what changed.
    In any case... surely there must be standard code to do this very standard formatting.
    I would be very grateful if someone could post some robust code to accomplish the following:
    REPORT DATA IN DETAIL ROW, ALTERNATE ROW BANDING:
    - Data in Detail row displays alternating row colors
    - Odd rows are always shaded, even rows not
    - Banding resets every group / does not continue pattern from previous group
    REPORT DATA IN GROUP ROW, ALTERNATE ROW BANDING:
    Some of our reports place row data in a group row (just the way it happened).
    If you could also modify your code in this case.
    Thank you!

    Hi Abhilash/Sastry, since I'm going to switch to Sastry's formulas, could you please confirm correctness of the following. I can't actually run this report, I can only provide it to our London office, bit of a lag for testing.
    @resetrowcnt:
    Whileprintingrecords;
    Numbervar cnt:=0;
    @rowcnt:
    Whileprintingrecords;
    if {HedgeDetails.StrategyID} <> previous({HedgeDetails.StrategyID}) and
    {HedgeDetails.DealID} <> previous({HedgeDetails.DealID}) then
         Numbervar cnt:=cnt+1;
    Details section (Suppress):
    not(OnFirstRecord) and
    {HedgeDetails.StrategyID}=previous({HedgeDetails.StrategyID}) and
    {HedgeDetails.DealID}=previous({HedgeDetails.DealID})
    Please note: Suppress checkbox is selected AND the above formula is entered.
    Details section (Color):
    Whileprintingrecords;
    Numbervar cnt;
    if cnt mod 2 <> 0 Then color(241,241,241) else crwhite

  • "group by" resulting in 'invalid number' error

    Hi,
    I have following query:
    SELECT from_locn from  appwms.PROD_TRKG_TRAN ptt 
    join
    (select locn_id,locn_brcd from appwms.locn_hdr where locn_brcd like '60-001-%') locn on locn.locn_id=ptt.from_locn
    where  ptt.TRAN_TYPE = 500
    This runs fine and displays results as below:
    FROM_LOCN
    0000317
    0000319
    0000319
    0000319
    0000319
    Now, adding a group clause results in error:
    SELECT from_locn from  appwms.PROD_TRKG_TRAN ptt 
    join
    (select locn_id,locn_brcd from appwms.locn_hdr where locn_brcd like '60-001-%') locn on locn.locn_id=ptt.from_locn
    where  ptt.TRAN_TYPE = 500
    group by from_locn
    ORA-01722: invalid number
    01722. 00000 -  "invalid number"
    *Cause:   
    *Action:
    Kindly let me know what I am missing here

    Hi,
    I don't see any obvious mistakes.
    Whenever you have a problem, post enough so that the people who want to help you can re-create the problem and test their ideas.  Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.Make sure the error occurs with the sample data you post.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Is there a way I can make a light not affect every group that is in 3D?

    Is there a way I can make a light not affect every group that is in 3-d?

    select the group Inspector>Properties>Lighting and switch the shading to off....

  • Totals after every group of rows - formating help

    Hi,
    What I need is to make the cells darker where the totals are after every group of rows. How do I do that?
    Also, I'm trying to remove the fact that they're merged cells for downloading to Excel (on another report for further analytics).
    Ex: a group of rows show multiple opportunities for an account. The Total NSR value (Revenue) for all the rows for the one Account is displayed after the rows and I don't want this on one of our reports.
    Thanks,
    Anita

    Are you talking about some pre-built report or a custom report you have created?

  • How to digit grouping in result grid?

    Hello Community & SQL Dev team,
    Asking on behalf of my workmate :)
    ===================
    Does anyone know to enable digit grouping in result grid?
    Display: 999,999,999
    Instead off: 999999999
    ===================
    Yury

    Thanks Barry, the feature request has been submitted:
    https://apex.oracle.com/pls/apex/f?p=43135:7:10812276646823::NO:RP,7:P7_ID:36181
    Forum members: visit the link and vote for the feature if you would find it useful.
    Cheers!
    Marc

  • How to Find what all GL assigned to Particular account group ???

    Hi !!! anybody can help me in this issue ... How to Find what all GL assigned to Particular account group ???

    Hi,
    Go to SE16
    Give table name SKA1.
    Give COA
    Give account group and execute.
    All the GL accounts that were assigned to this group are listed.
    Reward points.
    Sarma

  • Group by result in query

    how can i see the group by result in a query means show result also in groups i hope u guys understand wat i meann

    Mushy wrote:
    how can i see the group by result in a query means show result also in groups i hope u guys understand wat i meannJust select the GROUP BY columns. Not sure what you are exactly looking for. Lets say you have a table of employee and you want count of employee on each department you can do this
    SELECT deptno, count(*) FROM emp GROUP BY deptnoHere i have selected deptno and grouped by deptno.
    Is this what you are looking for?

  • Agent assignment for a task group

    Hi,
    I have created a TAsk group which has two workflows inside. But when go for the agent assignment for the task group via OOCU tcode, it is not showing the workflows under the task group.
    Plz let me know wht may be the problem...
    Thanks,
    Sivagami

    Hi,
      I am not able to assign agent through task customization [ OOCU Tcode ]. But I am able to assign in PFTC tcode.
      Any clues?
    Thanx,
    Sivagami

  • How to Assign Event to Auth Group

    Hello All,
               Please suggest is there any way to assign Event to Auth Group.
    Scenario is:-
    Add event ZHCM*  to its own authorization group.These changes to SM64 are needed in order to assign the transaction (restricted to the custom program only) to Payroll for kicking off their interfaces after each payroll run. Please create custom auth group say ZPAY and assign the ZHCM* event to this new auth group.
    Thanks in Advance !!
    Best Regards,
    CB

    i hope you are assigning to the radio group not to a radio button. i mean u could have radio group xx with buttons butt1,butt2 , butt3 etc. u cant have
    xx.butt1 := 100
    Besides that it's perfectly acceptable by oracle to assign to a radio group unless of course the variable is badly spelt
    Hope this helps
    Lewis

  • Group Policy Results wizard on Windows 8.1

    I am using the Group Policy Management console on Windows 8.1.  When I run the Group Policy Results wizard and target a computer running Windows Server 2003, I get the following error in the Details and Summary tabs: "An error occurred while generating
    report: There are no more endpoints available from the endpoint mapper".
    This only happens if I target a Server 2003 computer.  If I target Windows XP (and up) or Server 2008 (and up), it works fine.
    I tried running the wizard from a Server 2012 and a Server 2012 R2 computer and I receive the same error. If I run the wizard from other versions of Windows/GPMC, I can target those Server 2003 computers just fine.
    Also, the GPRESULT tool works from Windows 8.1 when I target a Server 2003 computer.
    Is Server 2003 no longer supported by the GP Results wizard or is something else messed up?  Web searches for that error just come up with things relating to Active Directory replication, Windows firewall, or the RPC locator service.

    > "An error occurred while generating report: There are no more endpoints
    > available from the endpoint mapper".
    Are server and client in the same network? If not: Double check ALL
    intermediate firewalls... I remember such a problem with a TMG between
    server and client, but I don't know the exact resolution - another
    member of the team reconfigured the TMG.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

Maybe you are looking for

  • No. of Columns in FR Report

    Hi All, Can you pls. let me know, how many no. of columns can we have in a FR Report ? In one Report that i'm working on is having nearly 60 columns and when i'm trying to view in Workspace, it is giving error message something like "out of memory" R

  • Is Comfort trade LTD is working under your company?

    because i want to know if they are working under your company. I want to buy some gadgets in Comfort trade LTD and the name of the person that is working in Comfort trade is (removed per forum guidelines)

  • Details on Exit plug

    Hi, I am working on Webdynpro for ABAP and would like to implement the Exit Plug functionality. Can any one provide me one sample program for my reference, so that it would be easy for my development. Regards, Ramya.

  • Help! Netscape browser problems

    Hi, This is my first time using layers, and I'm finding that Netscape 8 shifts text downwards slightly. I've posted the "Cafe Townsend" tutorial to illustrate the problem I'm getting- http://www.juliespetportraits.com/Cafe_Townsend/index_css.html If

  • Problems syncing a previously​-used Z22 with a Mac OS 10.4 iBook

    I want to remove the User name that originally was entered in the Z22 and replace it with a new User name to match up with the User name in my iBook and thus allow the file data in my iBook to sync over to the Z22.   However, I haven't found any inst