How to get 3table of values in the row of acronym in 11g

Hi all
I have 3 tables,
          Tab1
Ck_no   amt
1     2000


          Tab2

Ck_no          Line        amt
  1              1         1000
  1              2         1000


         Tab3

Ck_no         Line          sub        amt
1               1            1          500
1             1            2          500
1               2            1          100
1               2            2          200
1               2            3          700
In all ck_no tables is common.
Since the 3 tables above, I need the output in the following format,

Amt1    amt2      amt3     amt4   amt5     amt6    amt7        amt8     amt 9
2000    1000    1000      500     500        500     100        200       700
Can someone help me in this?

Thank you


Kind regards
Gurujothi

Published by: Gurujothi on July 9, 2012 20:46

Published by: Gurujothi on July 9, 2012 20:47

Gurujothi wrote:
I know how to get the values in a row for a single column,
...
but I get the error,

Too Many values

How do I change this?

Please post your data in the example, the expected results of these data and explain the logic so that we can understand how the data relate to each other.

In your original post, it is not clear how amt4, amt5 abd amt6 therefore show them all 500 when there are only two 500 values in the source data.

SQL> ed
Wrote file afiedt.buf

  1  with Tab1 as (select 1 as ck_no, 2000 as amt from dual)
  2      ,Tab2 as (select 1 as ck_no, 1 as line, 1000 as amt from dual union all
  3                select 1, 2, 1000 from dual)
  4      ,Tab3 as (select 1 as ck_no, 1 as line, 1 as sub, 500 as amt from dual union all
  5                select 1, 1, 2, 500 from dual union all
  6                select 1, 2, 1, 100 from dual union all
  7                select 1, 2, 2, 200 from dual union all
  8                select 1, 2, 3, 700 from dual)
  9  --
 10  -- END OF TEST DATA
 11  --
 12  select ck_no
 13        ,max(decode(rn,1,amt)) as amt1
 14        ,max(decode(rn,2,amt)) as amt2
 15        ,max(decode(rn,3,amt)) as amt3
 16        ,max(decode(rn,4,amt)) as amt4
 17        ,max(decode(rn,5,amt)) as amt5
 18        ,max(decode(rn,6,amt)) as amt6
 19        ,max(decode(rn,7,amt)) as amt7
 20        ,max(decode(rn,8,amt)) as amt8
 21        ,max(decode(rn,9,amt)) as amt9
 22  from (
 23        select ck_no, amt, row_number() over (partition by ck_no order by ord, line, sub) as rn
 24        from (
 25              select 0 as ord, ck_no, 0 as line, 0 as sub, amt from tab1 union all
 26              select 1 as ord, ck_no, line, 0 as sub, amt from tab2 union all
 27              select 2 as ord, ck_no, line, sub, amt from tab3
 28             )
 29       )
 30* group by ck_no
SQL> /

     CK_NO       AMT1       AMT2       AMT3       AMT4       AMT5       AMT6       AMT7       AMT8    AMT9
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
         1       2000       1000       1000        500        500        100        200        700

Tags: Database

Similar Questions

  • How to get the values of the rows in a column only?

    How to get all the values in the rows of a column.
    for example, a query gives result as:
    123
    234
    233
    12121
    all in different lines. But I want the result like this:
    123,234,233, 12121.All in a single row and a single column.
    How is that possible?

    SELECT rtrim (xmlagg (xmlelement (e, column_name |))) (') .extract('//text () '), ',') from table_name

  • How to get back my data for the health and the watch Apps once I've restored my phone?

    How to get back my data for the health and the watch Apps once I've restored my phone?

    From the backup, you're going to be restoration.

    If you back up to iTunes, make sure that it is an encrypted backup.

  • Try to play a movie but I have WMP cannot play the file how to get to play or delete the Xvid codec to play?

    How to get to play or delete the Xvid codec to play? Movies in AVI format, I converted it to WMP, but he won't play again

    No guarantee but maybe you need the XviD Codec.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    XviD Codec
    http://www.xvidmovies.com/codec/

  • How to get Camera Raw to recognize the new Nikon D500 camera raw files?

    How to get Camera Raw to recognize the new Nikon D500 camera raw files?

    Devices supported by Adobe Camera Raw

    The D500 has been supported since camera 9.5 Raw which is only compatible with versions of Photoshop CS6 and Cloud.

    What version of Photoshop are you running?

  • How to get audio to play on the timeline by rubbing through

    How to get audio to play on the timeline during the treatment, the clip is not cut, clip does not display an audio wave, looked through the help did not answer. When the clip is imported without options rise so uncertain where the issue is, any help is greatly appreciated, ty

    There is an option in the Preferences / Audio: audio playback while rubbing.

  • Have on current PC, Win 7 64 bit CS5; How to get *.exe to transfer to the new computer after removal of old

    Have on current PC, Win 7 64 bit CS5; How to get *.exe to transfer to the new computer after removal of old?

    https://helpx.Adobe.com/Creative-Suite/KB/CS5-product-downloads.html

  • How to use setViewportBounds (Bounds value) to the ScrollPane?

    How to use setViewportBounds (Bounds value) to the ScrollPane? This method is, visually, what for? I tried to put a specific Bounds.minY to have a precise scrolling in the axis Y in vain. I use the setVvalue() method to scroll, but it is not convenient to exactly locate a position in the coordinates of the node content listed in the scroll pane.

    The viewportBounds are the limits of the viewport (i.e., the visible part of the content) in the scrolling pane itself, if I understand correctly. The way to access programmatically is by setting the vValue property.

    I have not tried, but if you do something like

    scrollPane.setVmin(0);
    DoubleBinding vmax = new DoubleBinding() {
         { super.bind(scrollPane.viewportBounds(), content.heightProperty()); }
         @Override
         public double computeValue() {
            return content.getHeight() - scrollPane.getViewportBounds().getHeight() ;
         }
    };
    scrollPane.vmaxProperty().bind(vmax);
    

    to configure your component to scroll, then you can call setVvalue (...) and just pass a location of coordinates for your content node. This assumes that your content node is a region or a control; you will have to perhaps a little logic in the method computeValue() to deal with the cases where the display window is greater than the additional content.

  • How can getting error Code U44M1P7 during the upgrade, I fix?

    How can getting error Code U44M1P7 during the upgrade, I fix?

    Update product that you are trying to install?

    Is it compared to the creative or perpetual clouds?

    Please check following if you have creative clouds.

    http://helpx.Adobe.com/Creative-Suite/KB/error-u44m1p7-installing-updates-CCM.html

  • full outer join: how to get without null values?

    full outer join: how to get without null values?

    Hello

    Please go well this url

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:999478429860455:P11_QUESTION_ID:6585774577187

    Thank you
    Prakash P

  • How Oracle to store geometry values in the columns of the table?

    How Oracle to store geometry values in the columns of the table?

    Check this box:
    [Oracle Spatial User guide | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/toc.htm]

    Check other documents space here.
    [http://www.oracle.com/pls/db102/portal.portal_db?selected=7]

    Published by: Anantha R on August 20, 2009 13:43

  • How can I get a percentage value in the curves (formerly Cmde would show a point on the curve)

    How can I get a percentage value in curves - in CS5, it used to be Cmde would make a point on a point on the curve, to allow for precise adjustment...

    Hugh,

    Your screenshot shows that you're NOT watching the modeless panel that mentions Christoph Pfaffenbichler.

    This screenshot is not of all 'menu', as you call it mistakingly, but of the dialog modal adjustment, not a modeless adjustment panelthat would look like this:

  • How to get a combobox value name, not the export name

    I want to copy the name of the item to a combo box and view the selection in another text field, but I just got the value of the exports value name, and no ideas? Thank you for your attention.

    I created this combo box in a JavaScript document:

    var l = this.getField("BrandList");
    l
    .setItems([["ITEM LIST"],["ITEM 1","B010"],["ITEM 2","B020"],["ITEM 3","B030"],["ITEM 4","B040"],[" "]]);
    l
    .readonly = false;
    l
    .defaultValue = [ITEM LIST"];
    l.editable = false;

    Now, I want to display the name of the slected item ("ITEM 1", "ITEM 2", etc.) in another area, I tried this code in the text field properties > Calculate, where I want the name of the element is displayed, but I got the value of exports, for example "B010", "B020", etc.

    getField("NewField").value = getField("BrandList").valueAsString;

    First to get the index of the selected item: http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.701.html

    Can use it to get the name of the element (aka "face value"): http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.752.html

    For example:

    var f = getField ("combo1");

    var idx = f.currentValueIndices;

    FV var = f.getItemAt (idx, false);

    App.Alert (FV);

  • How to get taken time stated in the IO in the sequence editor?

    Hi all

    Is it possible to get the indicated default time NI Semiconductor Test Operator Interface OR in the sequence editor?

    Are there any expression in sequence editor that can get this time taken in the operator Interface?

    How can I include this time taken in the STDF generated by the transformation in the result sequence editor?

    Thank you

    Socket's operating time is stored in the TestResultsPropertyObject. To access this object is via the MainSequenceResult parameter in the Plugin model - USE fact entrypoint. The TS. TotalTime property records the total amount of time that required to run your test code MainSequence recall. It comes to the value included in the default reports.

    The OI shows the average decision-making time of execution of the whole lot, gets it from the Manager of semiconductor modules.

    I hope this helps.

  • How to read a counter value for the separation of the two edge before meter is stopped by the second edge (6602 Council)?

    I use a timer/counter with DAQmx 6602. I use the separation of two - available via DAQmx cash edge. Count between the two edges works properly, however I do not know how to read the value of the counter during the counting operation (i.e. after the first edge triggered the beginning of the count, but before the second edge triggered the end of the counting). I'll have to wait for the second goes off the edge of the end of the countdown until I can get a counter value. I need to be able to access the current value of the County during the count operation. This was possible in traditional DAQ. How can it be accomplished using DAQmx?

    Ah shoot - I was afraid that this might be the case (for what it's worth, my series of X returned intermediate values, but the material and the underlying driver are quite different)...

    You just need to take one measure at a time or you are buffer several measures of separation of the two edges at the same time?  So just to take one measure at a time, you can set a task of edges of count using the database internal time as the source using an arm start trigger (first edge) and a sample of clock (second Board) to work around the problem.

    Best regards

Maybe you are looking for

  • Skype freezes constantly on my installation of Windows 7.

    So, uh, I just got Skype 6.18 today, and I had problems with him constantly freezing and usually become numb, with it taking about eight to ten minutes to load a notification on one of my contacts is online. Literally everything I do in it causes unr

  • Battery problems with 4S after ios 9.1 installed

    After 9.1 install storage battery on my Iphone 4S down 12 to 18% per hour and hold on 50% power for there to be recharged. The stop function does not work now so I can't save energy when I am out by phone turning off the coast. Lost iTunes and the vo

  • Can I restore the folder "Images" at an earlier date?

    I save my photos on a disc when my computer crashed. As I had apparently cut instead of copy some files were lost. Is it possible that I can restore from an earlier date (such as the restoration of the system) and get my photos that I've lost the ret

  • 4540 proBook s and nobody left handed

    Hello world I am interested in the Probook s 4540 but I noticed that the touchpad is located on the left side of the pc. It is usable by a left-handed person? (is there some left hand person on this forum who use it) Thanks for any information

  • BlackBerry Q10 timer does not work for a project of 10 Q Lable in Blackberry

    Hi all I'm just a new Black Berry Q 10 and just beginner. I get some helpful solutions here to correct my mistakes. I am very grateful for this site and its members. In my application, I would like to add a timer to a lable. for every second, I want