Grouping and subgrouping

Hi Experts,

I'm looking to select who can give me results as below. I am fairly new and I tried

Data

=====

Select 'g1' group_key, prod "p1", "pd1" prod_dsc, "m1" month 1 sales of the double

Union of all the

Select 'g1', 'p2', 'pd2', 'm1', 2 of the double

Union of all the

Select "g1", "p3", "pd3'"m2", 3 double

Union of all the

Select "g2", "p4", "pd4", "m1", 4 of the double

Union of all the

Select "g2", "p5", "pd5", "m2", 5 double

Union of all the

Select 'g3', 'p6', 'pd6""m2", 6 double

ouput

=====

G1P3PD3M26
P3PD3M23
P2PD2M12
P1PD1M11
G2P5PD5M29
G2P5PD5M25
P4PD4M14
G3P6PD6M26
G3P6PD6M26

So basically prod, prod dsc and months is not known to the group, but will be retained on the best sales within the group. Any help is appreciated.

Thank you

with order by:

() AS T

Select 'g1' group_key, prod "p1", "pd1" prod_dsc, "m1" month 1 sales of the double

Union of all the

Select 'g1', 'p2', 'pd2', 'm1', 2 of the double

Union of all the

Select "g1", "p3", "pd3'"m2", 3 double

Union of all the

Select 'g3', 'p6', 'pd6""m2", 6 double

Union of all the

Select "g2", "p4", "pd4", "m1", 4 of the double

Union of all the

Select "g2", "p5", "pd5", "m2", 5 double

)

Select decode(grp_id,0,null,group_key) group_key,

prod,

prod_dsc,

MNTH,

sm_sales,

ROW_NUMBER() over (partition by order of decode(grp_id,0,null,group_key) group_key) o

de)

SELECT t.group_key,

Max (t.prod) Dungeon (first order by t.sales desc dense_rank) prod,

Max (t.prod_dsc) of Dungeon prod_dsc (dense_rank of the first order by t.sales desc),

Max (t.month) Dungeon (first order by t.sales desc dense_rank) month,

Sum (t.sales) sm_sales,

GRP GROUPING (t.group_key),

GROUPING_ID (t.group_key, t.prod) grp_id

T

Group of rollup (t.group_key, t.prod)

)

where PRV = 0

GROUP_KEY PROD PROD_DSC MNTH SM_SALES O
G1 P3 PD3 M2 6 1
P1 RDS M1 1 2
P2 PD2 M1 2 3
P3 PD3 M2 3 4
G2 P5 PD5 M2 9 1
P5 PD5 M2 5 2
P4 PD4 M1 4 3
G3 P6 PD6 M2 6 1
P6 PD6 M2 6 2

----

Ramin Hashimzade

Tags: Database

Similar Questions

  • Why Firefox keep save my last sites traveled as a group and then open this group when I start next time? It will not stop, and I get really mad

    Every time I close Firefox and I have a tab open, it records the tab as if I had recorded as a group and it opens the next time I start firefox again.

    You can check the startup parameter:

    • Tools > Options > general > startup: 'When Firefox starts': 'Show my home page' "show a blank page.
  • I followed some groups and contributors

    But did not get any updates by email all weekend.

    Change something?

    Thank you!

    Holly

    Make sure that you always follow these groups and that it contributes.  Over the years, I found that from time to time the forum destroyed my following, and I need to re - follow the things that I'm interested.

    I don't know if that's a problem, or if there is a way to ensure that the user is always really interested in getting these emails, and if they aren't, it will reduce the number of servers forum need to send emails.  TOTAL speculation on my part, but it happened to me several times since 2005 when I began to participate in the forums.

  • Added properties (Group and channel) are not a numeric data type.

    I use a use to add two groups and channel custom properties. The properties are text and digital, double and whole.

    When I create a request in the browser, I selects the custom using the drop-down list property, but has only the drop operator "=" or "<>". "" The property is displayed in the data portal is a number of float. I had this problem when I was adding properties custom by using a script. I then tried "Navigatorinstallation / my Index DataFinder/Reset/Reset", then repopulated my search box, using the use on my raw data files. At this point, all the properties of my have only the "=" or "<>" choice of operator in the query.

    It seems that my properties are digital in the data portal, but the the query string of the browser.

    Thanks in advance,

    Hi Bill,

    You don't have to delete the files.  Choose the NAVIGATOR menu "settings > My DataFinder > reset... '. "can clilck on the UPPER part of the two buttons, one called"reset the index.  Which will remove all records in database and re-index all of your data files.  If you one of these properties have already optimized, set their State not optimized before resetting the index, otherwise the optimized property data types will persist.

    If this does not help, then the problem could be in the use that you use.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • How do you find the name of the Group and channel your TDMS file name?

    How do you find the name of the Group and channel your TDMS file name?

    Nevermind, I've used the file viewer.

  • Major difference between the Group and the organizational unit?

    Pls explain me what is the difference between the groups and the organization unit in simple terms with an example in real time.

    Hello

    https://en.Wikipedia.org/wiki/Organizational_unit _ (computing)

    https://en.Wikipedia.org/wiki/Group _ (computing)

    See you soon.

  • How to remove messages in Exchange 2010 by dates. in a group and exclude the Contacts, record retention and calendar

    How to remove messages in Exchange 2010 by dates.  in a group and exclude the Contacts, record retention and calendar.

    I'm deleting emails from users in a group called MX_Purge file. I need to delete the emails date xx/xx/xxxx to xx/xx/xxxx.

    I also need to exclude the excluded the following records 'calendars' folders 'Contacts' and 'Retention '.

    The server people hang around more in the TechNet forums, if you ask, you will get a much better response:

    http://social.technet.Microsoft.com/forums/en-us/Exchange2010/threads

  • user belongs to a domain and user does not belong to the local administrator or power users groups, or any custom group and the user is not part of the domain administrators group, but user show that it is admin

    WinXP
    user belongs to a domain and user does not belong to the local administrator or power users groups, or any custom group and the user is not part of the domain administrators group, but user show that it is admin

    I did a gpupdate/force and restart twice PC
    Yet, user indicate it is always admin when we right click on Start menu and see the possibility to open all users

    Hi elena_ad,

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the public on the TechNet site. Please post your question in the below link:

    http://social.technet.Microsoft.com/forums/en/winserverManagement/threads

  • What support DH Cisco ASA 14 group and more

    What support DH Cisco ASA 14 group and more.

    Model and IOS

    Hi John,.

    You must have ASA executes code 9.1 and above for DH group 14 and this only work for ikev2 only.

    Kind regards

    Aditya

    Please evaluate the useful messages and mark the correct answers.

  • Several open BBM BBM groups and message being deleted

    Hello all: I've recently updated my BB Bold 9900 at a new classic. I made the switch of the device and my three BBM groups transferred nicely. After a week of use, no problem.

    Recently, in the last 7 days, I noticed my self-suppression cats when I have more than one group of ongoing discussion.

    Then, with two or more BBM group discussion going, I will get a notification in the HUB that someone sent a message. I can see the preview in the HUB. I touch the notification in the HUB, and it opens the BBM "app." As soon as it opens I see quickly the cat disappear, as well as any history behind it.

    If I get a notification and I go to the BBM app directly, sometimes the cat is there and sometimes the cat is deleted. I put the story for all the conversations of "forever".

    EDIT: Don't know if this helps, but some of the participants in the group the cats are on iPhone and/or device Samsung Galaxy.

    Has anyone else had this happen to them and if so, is there a solution?

    Thank you

    G.

    Make another person in the Group and the administrator and then it prompts you to come back and make you an administrator once they invite you to come back. Everything will remove and then Resync.

  • Trunk group and hunt inter-classes CUCM

    Hello

    I think I have some notion about what I have to do to get what I want to do, but it's always a good idea to get your expert advise to validate my plan.

    I have two clusters of CUCM 10.5 standalone. We have VPN connectivity between these sites. Site A has a group with call of broadcast distribution. If nobody takes the call, he goes to voicemail. Now my management wants to add an extension of Site B in this group of hunting, there will be a distribution more call coverage or load. My thought is to create ICT between the two groups and add the extension of site B in the hunting group. Is there another better way? Do I have to create a trunk of ICT? I need to make sure that the call goes to voicemail if no one picks up the call. Thank you for your help on this.

    ~ Khanal

    No, when you go to the Group of curves, you will notice the only things that you can add is a real number of directory. If the requirement is ring let simultaneously or circular between local cluster DN then build a ling group for it and then the backup is another cluster DN, DN build with single number reach destination pointing to the other cluster and then build the second group of line with this unique name. In your list of hunting point to two groups of line.

  • How to create the home group and how to connect two computers that are running windows 7. and also Remote Desktop connection!

    Someone help me how to create the home group and how to connect two computers that are running windows 7. and also Remote Desktop connection!
    step by step information!

    Hello

    I suggest you to refer to the links and check if it helps:

    Create a homegroup

    http://Windows.Microsoft.com/en-us/Windows7/create-a-HomeGroup

    Join a homegroup

    http://Windows.Microsoft.com/en-us/Windows7/join-a-HomeGroup

    Setting up a network home

    http://Windows.Microsoft.com/en-us/Windows7/setting-up-a-home-network

    Remote Desktop connection

    http://Windows.Microsoft.com/en-us/Windows7/products/features/Remote-Desktop-connection

    What types of connections remote desktop should I allow?

    http://Windows.Microsoft.com/en-us/Windows7/what-types-of-Remote-Desktop-connections-should-I-allow

    Remote Desktop connection: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/Remote-Desktop-connection-frequently-asked-questions

    Let us know if it helps.

  • How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    Hello

    I want to give as open & export to the level of permissions.

    How to create user defined groups and users with custom permissions as only open and export in obiee 11 g?

    For example, if the group permissions, inturn should reflect on the users.

    Please help me.

    Thanks in advance,

    A.Kavya.

    Your question is quite broad and fuzzy then I suggest the security catalog presentation to read documentation: http://docs.oracle.com/middleware/1221/biee/BIESC/mgrgrpsusers.htm#CIHIBJGD

    And I think that you mix you two things which are managed in different places:

    ) an object as read access permissions, write, delete... which control you through the object "Permissions" dialog box

    (b) functional privileges controlled through "Manage privileges" under "Administration".

  • Groups and sharing accounts

    My company uses groups to distinguish between different client users.  So example, Client A is a group, and Client B is a group.  I want every Member in the other group to be able to share with other members of the same group, however I do not want a group to be able to see other groups in my organization.  This is what happens... I am member of A Client, when I click on sharing of status within my profile and click on the button "+" to add an email address, I then click on the down arrow next to 3 horizontal lines.  Even if I am a member of Group A customer, I can see the group for Client B and expand it to see users in this group.  In any case to avoid this and still allow members of each group to sign, edit and modify the agreements within each group?

    Hi Margery497,

    Please refer to the below KB documents to help:

    - Modify the group settings

    - Account sharing between users

    - Adobe sign support | Tasks and settings admin

    Feel free to contact us if you have queries or concern.

    Kind regards

    Nicos

  • How to set up users, groups, and security role in WebCenter E-capture 11.1.1.8.0

    Hello

    I need to set the security of user group and the role of E-Capture but not no matter what doc and I configured 5 reviews in web logical console with the administrator group, but faced with a problem that is mentioned below

    Problem:

    (1) in the E-capture show only user weblogic and I'm not able to search for any user.

    (2) not yet able to connect to e-capture console and client using another user except weblogic.

    Please guide me how to set security for e-capture console and customer e-capture.

    Thanks in advance

    Sanjeev

    Hello

    Connect to Enterprisemanger-> right click on the domain-> titles-> roles and policies

    Then select capture and navigate to capture roles add LDAP users and groups to roles according to your requirement to capture. If faced with any LDAP related issues can create the user with the admin role and try to add it all first by assigning the two roles out there. Hoping that this will certainly help.

Maybe you are looking for