[PIVOT] amount to combine with other pivot?

Hello.

I have this statement in my 11g database:

WITH my_data AS
       (    SELECT    'pave'
                   || MOD( LEVEL
                         , 2
                          )
                     AS pave_name
                 , MOD( LEVEL
                      , 2
                       )
                     AS pave_version_nr
                 ,    'Cogr'
                   || FLOOR(   (  1
                                + LEVEL )
                             / 2
                            )
                     cogr_name
                 , LEVEL AS value_init
                 , 2 AS value_delivery
                 , 'fakjfhajhfkajöfdsgaösfdghöaoifdsgöafsghöa' AS coin_names
              FROM DUAL
        CONNECT BY LEVEL < 9)
  SELECT *
    FROM (SELECT ROW_NUMBER( )
                   OVER( PARTITION BY cogr_name
                         ORDER BY
                           pave_name
                         , pave_version_nr
                        )
                   AS set_id
               , cg.*
            FROM my_data cg                                                                                                               --
                           )
ORDER BY cogr_name;

where this result:

PAVE_NAME PAVE_VERSION_NR COGR_NAME VALUE_DELIVERY COIN_NAMES VALUE_INIT SET_ID

---------- ---------- --------------- --------- ---------- -------------- -----------------------------------------

1 pave0 0 Cogr1 2 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

2 pave1 1 Cogr1 1 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

1 pave0 0 Cogr2 4 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

2 pave1 1 Cogr2 2 3 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

1 pave0 0 6 Cogr3 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

2 pave1 1 Cogr3 2 5 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

1 pave0 0 Cogr4 2 8 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

2 pave1 1 Cogr4 2 7 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

For each separate COGR_NAME, I need to compare, VALUE_INIT, VALUE_DELIVERY and COIN_NAMES.

so my desired output is:

PAVE_NAME_1 PAVE_VERSION_NR_1 COGR_NAME_1 VALUE_INIT_1 VALUE_DELIVERY_1 COIN_NAMES_1 PAVE_NAME_2 PAVE_VERSION_NR_2 COGR_NAME_2 VALUE_INIT_2 VALUE_DELIVERY_2 COIN_NAMES_2

----------- ----------------- ----------- ------------ ---------------- ----------------------------------------- ----------- ----------------- ----------- ------------ ---------------- -----------------------------------------

pave0 0 Cogr1 2 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa pave1 1 Cogr1 1 2 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

pave0 0 Cogr2 4 2 pave1 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa 1 Cogr2 2 3 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

pave0 0 Cogr3 2 6 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa pave1 1 Cogr3 2 5 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

pave0 0 Cogr4 8 2 pave1 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa 1 Cogr4 2 7 fakjfhajhfkajofdsgaosfdghoaoifdsgoafsghoa

I tried a solution COGR_NAME and max() uses groups to keep (dense_rank last/first order of set_id) but it does not work with COIN_NAMES which is really a CLOB.

So I guess it's possible with the pivoting of the query but any other solution is also welcome...

Good bye

DPT

Hello

One way is with a self-join, like this:

WITH got_analytics AS

(

SELECT d. *- or whatever the desired columns

ROW_NUMBER () OVER (PARTITION BY cogr_name

ORDER BY pave_name

pave_version_nr

) AS set_id

, COUNT (*) OVER (PARTITION BY cogr_name

) AS n_rows

OF my_data d

)

SELECT a1.*, a2. *- or other columns of your choice

Got_analytics A1

JOIN a2 ON a1.cogr_name = a2.cogr_name got_analytics

WHERE a1.set_id = 1

AND a2.set_id = a2.n_rows

ORDER BY a1.cogr_name

;

Tags: Database

Similar Questions

  • A combine with other values of the column, the column values


    Hi all

    I need your help on this. I have a req I need to combine values of a percentage to the values of column test column. Here are examples of data

    Select decode('test',null,'ABC') abc, b.percent, b.amount

    from tableA, tableB b

    where id = b.id

    Examples of data

    Amount of the percentage TEST

    ABC              0.3                10

    ABC              0.5                20

    ABC              0.2                30

    After him combine the values of percentage to the ABC percentage column values must be zero

    Desired output

    Amount of the percentage TEST

    ABC(30%)                              10

    ABC(50%)                              20

    ABC(20%)                              30

    Valuable suggestions are appreciated

    Alter the query from Etbin with a trifle for the exact release.

    with

    t as

    (select 'ABC' test, 0.3 percent, 10 amount of all the double union

    Select 'ABC', 0.5, 20 double Union all

    Select 'ABC', 0.2, 30 double

    )

    Select test | ' ('| to_char(100 * percent) |'%)' test, null as a percentage, the amount

    t

  • the event structure cannot combine with other events and run only once

    Why it will always get stuck when I combined the 'new user add' event to the event of 'Login '?

    It works for me when I separate the two, but the 'Add a new user' button can work but only once for the structure above, program will be blocked on the second time that I press the button "add a new user".

    It has already been said, you must use that a single structure of the event and not 2. Also, avoid using local variables (better store data in a shift register and not in an indicator) how you do it, it can cause bad racing conditions.

    Actually here you just don't another data storage since you have a file. Don't store data file to the root of the C drive, you do not have write permission. Use the default data folder or the folder of the application.

    I have attached a simple example. I guess that's a work at home? Please make my account help: try to understand why your VI does not work and try to find a solution by yourself. Modify my sample and play with him. This is how you learn LabVIEW. If something is not clear, post here, and we can explain/help.

    Edit: has the 'connection' event, I don't check against whether the file exists or not. Difficulty of this part, gives too little practice.

  • Contacts are combined with others during the synchronization of google

    I'm having a problem where some of my contacts are getting merged during synchronization of google.

    For example, I have 3 contacts:

    Shipping of 1 company that owns two phone numbers

    2 transmission, which has two business phone numbers

    Shipping of 3 company that owns two phone numbers

    On my pre, I see two entries of contacts:

    Shipping of 1 company that owns two phone numbers

    2 transmission, which has four telephone numbers of the company

    I can't get 3 company, but their phone number appears under the company 2.

    Ideas, suggestions, etc.

    Hi rjoffe,

    Welcome to the forums of Palm! In your specific example, open the contact for shipping of 2 company, then tap the header at the top. A list appears showing all sources of data for this contact. Tap the 3 company shipping option, then select Remove the link profile. This will separate 3 company so that it is a separate contact.

  • What exact HP Laser Jet models are combined with CB518A?

    I have a question about the product Hewlett - Packard P 500-sheet input tray - LJ P401x/P451x Series (CB518A). What exact HP Laser Jet models are combined with CB518A?

    I looked through your website but I couldn't find anything on CB518A. Then I tried Russian/English sites (online markets), but the information differs from one site to the other. I need this information!

    Hey ana banana

    I looked in the paper that you are connected.  The series P4010 mentioned refers to the P4014, P4015 I mentioned above.  It seems that the paper tray is also compatible with the P4510 series which is an improved version of the model P4010.  The P4515 is referenced by instructions P4510 printer.

    So far, these are printers only 3 that I found using this paper tray, however.

  • can I share all my photos with Lightroom high resolution with other people who have creative cloud? If yes how can I do this?

    Can I share all my photos in high resolution in Lightroom with other people who have creative cloud? If yes how can I do this? Is there a maximum amount of space that I can use? Others can add photos to the same place?

    Hi alexn,.

    If your subscription includes Mobile with Lightroom, you can create collections to synchronize the images needed and to make this collection public so that others can see these images although will not images high resolution.

    Intelligent previews of these images will be synchronized.

    Check this link for the tutorial:

    Collections «Julieanne Kost's Blog»

    You can also check out the tutorial to get started with Lightroom Mobile first:

    Get started with Lightroom for mobile

    How to start using Lightroom on mobile | Adobe Photoshop Lightroom CC tutorials

    Although others may not add their photos in your collections.

    And this can be done if you have the creative cloud subscription which includes Mobile with Lightroom.

    Kind regards

    Claes

  • Can join us variable liquids with other variables or/strings of data in the declarations of liquids

    Can join us liquid variable with other channels for use in conditions or other liquid or variable methods?

    For an example simple Assembly variable/data with a string:

    {% assign newVar = globals.get.id + "#anchor" %}

    to get the result:

    newVar = / page-name #anchor

    or two variables in a conditional Assembly:

    {% assign var1 = "xy" %}

    {% assign var2 = 'z' %}

    {% If xyz is var1 + var2 %}     (but not + as in addition to math, actually join the 2 resulting from the chains of var1 and var2)

    so the if statement would be true.

    You don't need to capture Robert

    Adam,

    First is the sign + - in a liquid, it is 'more '.

    {{500 | more: 20}}

    And combine a string:

    {% assign var1 = "xy" %}

    {% assign var2 = 'z' %}

    {% assign combine = var2 | append: var1 %}}

    {{combine}}

    Capture is a double pass less effective.

  • Combine with a similar request has plunged to values

    Dear all,
    I have a report with the help of combined with a similar request. (Union)

    TableA
    Name in the amount of SAR

    TableB
    AMT name SAR

    Result column:
    Name salary

    My requirment in the result of salary column I have shoul use divided by 100.
    When I shot the fn button I am unable to see in the result column.
    How to divide 100 then Multipla with another column of result SAR

    Thank you
    Govind R

    Hello
    In order to divide the salary by 100, on each separately criteria under treatment fx.

    Kind regards
    Srikanth

  • Lost money after combine with a similar request

    Hi experts

    I used the option "combine with a similar request" to combine the 2 reports that have exactly the same columns.
    The only difference between them is that they use different filters.
    The action of the combine is made correctly but the sum over the years is missing
    When I run the 2 reports separately for each of them that the amount is shown in the report but when I combine it is absent.


    Can anyone explain why?

    Published by: aharrab_be on April 30, 2009 10:32

    who discovers that you are using. ?

    rule of sum game aggregation and try in privot... for this measure.

  • Accidentally, I put my Macbook not in the stream with other devices

    It is a real irritable and I hope that someone can help you. I've had my Macbook Pro for about 4 years now but had never used icloud.  When I decided to start doing so yesterday I went in iCloud in settings and seen something like: "Do not allow for synchronization with other devices" and accidentally ticked.  Everything already worked well without using iCloud, but now nothing can be synchronized with the Macbook.  Is there something I can do?  I see that the boot Volume has been changed yesterday who must account for this.

    Questions of clarification - were you when you saw synchronizes them only not in System Preferences/iCloud? If this isn't the case here, where were you? If you go into System Preferences/iCloud can you check the boxes to synchronize?

  • GoDaddy email login now systematically fails with firefox, but works with other browsers

    Logging to GODADDY EMAIL WITH https://login.secureserver.net/index.php?app=wbe & domain = email.allancarstens.com
    URL GENERATES javascript:$('login_form').submit(); URL
    AND DISPLAYS [object Object]

    HE WORKED WITH FIREFOX AND STILL WORKS WITH OTHER BROWSERS.

    You can attach a screenshot?

    • Use a type of compressed as PNG or JPG image to save the screenshot
    • Make sure you do not exceed the maximum size of 1 MB

    You can try the following steps in case of problems with web pages:

    You can reload webpages and ignore the cache to refresh potentially stale or corrupt.

    • Hold down the SHIFT key and click the Reload button
    • Press 'Ctrl + F5' or 'Ctrl + Shift + R' (Windows, Linux)
    • Press 'Command + shift + R' (Mac)

    Clear the cache and delete cookies only from Web sites that cause problems.

    "Clear the Cache":

    • Firefox/tools > Options > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox/tools > Options > privacy > "Use the custom settings for history" > Cookies: "show the Cookies".

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe
  • After the recent Firefox updates prevent links to several websites to operate while it doesn't have this problem with other browsers - help please.

    Since a recent update of Firefox links to several Web sites is no longer working. They used to be fine and I liked Firefox. The problems do not exist with other browsers such as Internet Explorer, Google Chrome. Specifically, on talktalk.co.uk news links do not work, any more than those in 'my account '. On Barclays.co.uk the link to print my statement works no-same on MBNA.com
    There are several solutions proposed around the internet, but all are complex, so far none have worked and I don't see why I should have to make the suggested adjustments. Firefox has been great - now, it is not. The problem seems to be the update. Please help me get my Firefox where it should be.

    AFAICT then who are perfectly normal links on the news page

    The http://www.talktalk.co.uk/ opens if I click the guide Link TV/news on the https://sales.talktalk.co.uk/ page.

    If I right click on a link and use inspect element to open the Inspector then I see that there is an event onclick on the links (annex 'ev' button), so make sure that you are not blocking JavaScript.

    Start the computer in safe mode Windows with network support (on the startup screen, press F8) as a test to see if that helps.

  • Apple script to check the part of iTunes XML library with other applications.

    Y at - there no apple for script

    Check "Sharing iTunes library XML with other applications." Of

    • iTunes
    • Preferences
    • Advanced tab...

    I want to read itunes Media Library .xml but lates itunes no xml is created by default,

    so I want this XML created by my application through the apple script.

    iTunes12.4

    https://discussions.apple.com/message/28513383#28513383 - new with the parameter preferably 12.2 iTunes to turn create .xml

    If you really want an AppleScript, I think you should ask on the iTunes for Mac forum, or maybe the OSX Technologies.

  • the video is the future. How do videos PLAY when sharing with others?

    How to make video content on game Keynote when shared with others.

    Hey dominiek releases,

    Thanks for this info and choosing the communities Support from Apple. I know how important, given your speech work the way you want when share you!

    If I understand correctly, you want the video to play automatically. Good news is that it looks like it is possible!

    «When the media begins to play in Keynote: check the box "start the media when the click on" to start playback when you click.» If you want the media to play automatically when the slide is displayed, uncheck the box.

    Add video and audio - speech help

    See you soon!

  • Using an IP191 monitor, have random horizontal stripes on the screen - have no problems with other browsers. also no problem with FF on the other PCs on the family

    Using an IP191 monitor, have random horizontal stripes on the screen - have no problems with other browsers. also no problem with FF on the other PCs on the family.

    These "streaks" seem to be the domain of the high frequency analysis; they can be eliminated by scrolling upwards or downwards.

    Hello, maybe it's a problem with hardware acceleration - try updating your graphic driver, or in case this does not solve the problem, or there is no new version available at the time, disable hardware acceleration in the firefox menu

    > options > advanced > General.

Maybe you are looking for

  • Pavilion TS 15: computer hp laptop pavilion extend windows 8.1

    I'm trying to get an extended display of my laptop to an external display.  I have Windows 8.1, the 64-bit operating system.  My second monitor is an HP w2007, connected with cable (for computer) HDMI to a DVI (to watch).  The computer detects the se

  • Satellite M30x-115: Fn + F5 does not work

    I have problem with Fn + F5 key, is not scroll the available screens. (I lost the other monitors and I have no signal for other currencies TV). Any ideas how to fix?The laptop is a Satellite m30x 115 Thanks for your help. Haris

  • Satellite M40 - speakers with web based streaming

    Recently bought a laptop Satellite M40. Last week, I started having a problem with the playback of certain audio stream on the internet. Basically, you hear the audio OK, only comments and sounds high through the speakers or the speaker I use via a U

  • Communication between PCI6251, Labview and Matlab

    Hello I work with a Council of PCI6251, driven by an executable labview. I get measurements from several sensors (pressure, temperature, etc.) which are read by the executable of labview. I would like to know if it is possible to send these Matlab me

  • Need help, PNY optima 2 GB SD card

    I have a PNY Optima 2 GB SD card, but every time I plug my SD card out of my camera in one of my computers it happens the same thing that my other SD cards but when I try to open a message box comes up and tells me to insert a disk? And when I put a