Table rotates

I have a table as follows

trandate accno closing balance

12/01/09 01, 2000
01 28/11/09 1500
11/28/09 02, 4500
11/28/09 04, 1200
11/27/09 01, 2300
26/11/09 06, 3300
11/26/09 02, 1300
11/26/09 03, 1300
11/25/09 01, 4600
11/20/09 04, 4700
20/11/09 06, 7120
10/10/09 01, 5200
22/10/09 02, 1000
I need to get a report as follows for each accno.

Date column should contain dates of months 1st registration. This means that if today's 15-dec-09, then it will be

as:

Date
----
1st November 09
2 November 09
------
------
14-dec-09

And in the balance column, please fill this days closing balance. If this closing balance is not days

available, so we fill it to balance available before.
It will be like this

accno Date balance
11/01/09 01, 5200
11/02/09 01, 5200
11/03/09 01, 5200
--               --------          ----
--               -------               -----
11/27/09 01, 2300
01 28/11/09 1500
01 29 / 11/09 ' 1500
01 30/11/09 1500
--               --------          ----
--               -------               -----
12/01/09 01, 2000
--               --------          ----
--               -------               -----
14/12/09 01, 2000

02 SO NOW...

Please let me know if yu need any clarification on the issue.

TNX for your time!

Hello

According to you requirements:

user10313295 wrote:
...
Date column should contain dates of months 1st registration. This means that if today's 15-dec-09, then it will be

as:

Date
----
1st November 09
2 November 09
------
------
14-dec-09

The last date in the data sample are in April 2009, well before November 1, 2009, which explains why sales are all NULL
It is reasonable to have the latest balance of before 1 November in situations like this.
Perhaps the best way to encode using COALESCE (LAG..) instead of just LAG:

WITH     all_days     AS
(
     SELECT     TRUNC (SYSDATE) - LEVEL          AS a_date
     FROM      dual
     CONNECT BY     LEVEL <= TRUNC (SYSDATE) - ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                                                        , -0 -- 1
                                         )
)
SELECT     x.cust_ac_no
,     a.a_date
,     COALESCE ( LAST_VALUE (avl_balance  IGNORE NULLS) OVER ( PARTITION BY  x.cust_ac_no
                                                           ORDER BY       a.a_date
                                          )
           , ( SELECT  MAX (avl_balance) KEEP (DENSE_RANK LAST ORDER BY avl_date)
               FROM    il_actbs_adjavl_balance
               WHERE   cust_ac_no     = x.cust_ac_no
               AND     avl_date     < SYSDATE
             )
           )                    AS balance
FROM            il_actbs_adjavl_balance     x     PARTITION BY (x.cust_ac_no)
RIGHT OUTER JOIN  all_days               a     ON       a.a_date     = x.avl_date
ORDER BY  x.cust_ac_no
,            a.a_date
;

COALESCE does not evaluate its 2nd argument if it is not, so COALESCE will be more effective than the NVL.
You could also do the scalar subquery as 3rd argument offset.
If you have whole month where you have to call this scalar under request (as you do in the sample data), it would probably be more effective to calculate the balance of the last before November 1st, once per account, in a separate subquery and include the results of this auxiliary request with all_days.

If you want the query ends at a given point in time, rather than yesterday, then use the next of this endpoint instead of SYSDATE.

Tags: Database

Similar Questions

  • table rotates in the measurement to the dashboard column

    (2) in the dash pivot value click, measurement value measures a contain quantity of the sample, this amount has ('total amount of names of the no.of), this amount, click on the display names is possible?

    Published by: Ashok Sep 24, 2010 05:09

    Published by: Ashok Sep 24, 2010 05:35

    Hello
    You mean you want to navigate when you click on these values (45,55,65 etc...)?
    If to criteria under the column properties-> format this measure column column to use interaction value naviagte-> Select report or dashboard.

    Thank you
    Srikanth

  • on the table privot?

    When I do a privot table.i to use the finishing table to draw a gauge.but there is no options to choose in the table rotates results? How to get there.
    Thank you

    After building pivot table, you select graphic option when you get the screen on the top you will find option pivot chart and select the chart you want to display so it comes exactly w.r.t. to the pivot table view.

    UPDATE POST

    Use the class view and this view of pivot... Place both in the view selector and rename the pivot and assess accordingly and this is what you want.

    UPDATE POST 2

    I mean I want to use the privot data draw a gauge? How to do?

    The data that comes with columns that you built in the PivotTable, the same would come when you use the same gauge view columns discover it by building it and then you will learn about its operation. Give it a go.

    See you soon,.
    KK

    Published by: Kranthi.K on April 15, 2011 06:39

    Published by: Kranthi.K on April 15, 2011 07:06

  • A chart by customer

    I have a report in Oracle Bi answers with several customer-id: s in a table.
    I also want to show this graphically, but I want a customer by id chart. Is this possible to do?

    In responses, Pivot table you can do. Select "table rotated results" and move the client code in the sections tab you will get separate graph for each customer id based on the measure.

  • Graphic Pivot format

    Hello

    Is it possible to change the color of the bar and line graphs in pivot charts? Is there a graphics option to do this?

    Thank you

    Hello
    After clicking table rotated results you get chart and PivotTable. Below you can see the icon format chart data fifth icon from the left) where you can change the colors of the chart.

    Kind regards
    Srikanth

  • SWAPING

    I HAVE THE TABLE AS A VALUE N

    NAME OF TABLE ROTATION
    SWAP1 COLUMNS AND SWAP 2
    I HAVE VALUES SUCH AS.
    11 66
    22 77
    33 88
    44 99
    22 88
    11 88

    NOW I WANTO TO SWAP COL1 TO COL2.
    (REPLACE)... ? ANYONE CAN WRITE a QUERY IN ORACLE 9I and 10G supported
    SQL> ed
    Wrote file afiedt.buf
    
      1  create table swaptest as
      2  select 11 col1,  66 col2 from dual union all
      3  select 22, 77 from dual union all
      4  select 33, 88 from dual union all
      5  select 44, 99 from dual union all
      6  select 22, 88 from dual union all
      7* select 11, 88 from dual
    SQL> /
    
    Table created.
    
    SQL> update swaptest
      2  set col2=col1,
      3  col1=col2
      4  ;
    
    6 rows updated.
    
    SQL> select * from swaptest;
    
          COL1       COL2
    ---------- ----------
            66         11
            77         22
            88         33
            99         44
            88         22
            88         11
    
    6 rows selected.
    
  • Rotation of introductory text to a table

    No indication on how to rotate the text in a table like in excel would be appreciated. The rotation function does not appear to be activated?

    As in the Pages and Numbers, there is no rotation of text in cells in the tables. You must insert a text box, turn 90 ° and then eyeball its alignment within the cell. It isn't in the cell, but floating above it by default and behind it if you wish. Alignment in the reorder tab controls are unnecessary for the centering of the text box in the cell.

  • rotate the table

    Hello!

    We have a 1Darray with values and we want to rotate/shift values (3 positions). But she moves whenever we want to read the table.

    For example: we have [1 2 3 4 5 6 7 8 9 10] and we want for the quarter 3 positions as [10 9 8 1 2 3 4 5 6 7] we want to send this table, read it and then turn and read every time until we get the first table.

    Should we use loops or we can put directly?

    All responses are welcome!

    Thank you!

    Why did - it always people who insist on the things a way more complicated than it should be...

  • Rotating table with 6 test stations. How to track the results data at each station to a machine of rotating table with 6 test stations?

    I would like to know if someone has worked with table Rotary testsystems and want to share an idea of how he dealt with follow-up of the results of each test result data in all the test station is in the table of rotation, so at the end of the cycle the results of good data by each DUT. There's a kind of technique used in arrays or clusters?

    Any comments would be grateful.

    Hi shada

    There are many ways that you can store your results, such as Matthew commented that you can use an array of Clusters. I would recommend this table of cluster storage in a Global Variable that is functional to make data transfer safer and easier to climb. There are many examples on how to use them on the community.

    There are a few tools in advance that you can also use to store your results as Of present value Tables (CVT).

    TestStand parallel model with the "Result of processing" option enabled stores automatically all the results of your Tests.

    Hope this information is useful.

  • Rotate the movieclip in a table

    I created a table in my main script to fire constantly melons. I need the bowler to turn in the air I know I can use a variable of rotation, but I don't know where to put it. Help and advice is appreciated, thanks.

    melons
    var melonSpeed = 10;
    var melonReady = true;
    var melonDelay = 100;
    var melonAmount = 0;
    var melonArray = [];

    function createMelons() {}
    var melonMc = this.attachMovie ("melon", "melon" + melonAmount, 1000 + melonAmount);
    melonAmount ++;
    melonMc._x = _root.hero._x;
    melonMc._y = _root.hero._y;
    melonArray.push (melonMc);

    }
    function moveMelons() {}
    If (melonReady & & Key.isDown (Key.SPACE)) {}
    melonReady = false;
    currentTime = getTimer ();
    createMelons();

    } else {}
    {If (currentTime + melonDelay < = {getTimer())}
    melonReady = true;
    }
    }
    for (var i = 0; i < melonArray.length; i ++) {}
    melonArray [i] ._x += melonSpeed;

    }

    }

    onEnterFrame = function() {}

    moveMelons();

    While you change the _x property you can also change the property _rotation... something like...

    for (var i = 0; i)
    melonArray [i] ._x += melonSpeed;

    melonArray [i] ._rotation += melonRotation;

    }

  • Rotate text in a heading in a table row

    For the purposes of space, I would like to turn the direction of my text in the header of a table row.  Is it possible to do?  Thank you!

    Click on the object, go to the page layout and select rotation.

    Steve

  • FM7.2: Problems with frame anchored in the rotated table cell

    Hello O Experts,

    I am facing a nasty problem with FrameMaker 7.2 for Windows with frames embedded in rotated table cells. I was wondering if any of you have seen this problem and know how to solve.

    The problem is reproduced as follows:

    1 create a table.

    2. Add a small frame anchored "the point insertion" inside one of the cells.

    3. Add a line of text to the anchored frame.

    4 turn the cell by 90 degrees clockwise or counterclockwise.

    Up to step 3, the anchored frame and the line of text behave as expected. Can I choose both the frame and the text line, move and resize. In all cases, they are displayed correctly.

    After step 4, the following occurs:

    • The content of the anchored image appear or is badly distorted.
    • Is no longer, I can select or resize the anchored frame (if I try, FM acts irregularly and wildly moves the outline around the page).
    • I can choose is no longer the line of text in the frame.

    I enclose a file FM (created using integrated model "portrait" of FM) sample that illustrates the problem.

    If someone knows this problem and I hope a solution, I would greatly appreciate it if you'd share. Thank you very much!

    Michael,

    If you turn just the anchored frame itself and not the cell (content) then everything behaves. If you have lots of content for the anchored frame, then place a block of text in the anchored frame, use a suitable paratag in text and only turn the framework anchored (all content will follow along then).

  • Tips for placing graphics rotated in a table

    To help save space, I would like to put 4 graphics in a table of columns 4 rows x 2 and have the page in landscape format (see attached PDF for the pattern of layout you want).  What type of cell should be used for titles figure to get the desired results: portable table, block of text, anchored frame, other?

    I tried a table cell, but I do not know how to set the line height.  Rotate the text was easy.  But it's the height since I do this landscape, right?  As I continue to type the title of the figure, the height of the table row continues to grow.

    Maybe I shouldn't try to place the graphic titles and appear in a table.  My numbers are wider that they are bigger and that's why I want the global page to be landscape.  I would like to do this several times in a book.

    You really should do a landscape page master to hold tables like this. It will sort your numbering as well. The plan you are gettting corresponds to a table without rotation, i.e. Turning the contents of the individual cell does not give you a table of rotation.

    For a quick tutorial on creating a page master landscape rotated, see: http://wiki.scriptorium.com/tiki-index.php?page=Adding+the+LandscapeRight+master+page

    Note: You can use the MasterPage FM mapping tables to automatically apply the master page to the table anchor paragraph. See: http://wiki.scriptorium.com/tiki-index.php?page=Mapping+paragraph+tags+to+master+pages

    Also, remember no rotation (Format > Page customize > turning a Page...) pages in landscape when creating output or you find may be cut.

  • Rotate a Cartesian table field

    Hello

    Suppose I have a 2d array(360x2) which is taken from text file and all the elements are converted to Cartesian and placed in the xy table and plotted as well. Now, I want to turn xy table traced using slides. I enclose 2 files of text corresponding to the r-theta table and xy table. Kindly help me ths issue.

    Well, it's the way in which the angle of turns of complex numbers.

    Why did you put r = 3 default? Just to make sure that we can not see the data?

    Why not clean the diagram and replace the bundle with "RE / IM at the complex.

    You you use Q & R to divide the angle by 360 table and use the rest to wrap correctly. (See photo)

  • Rotate several tables of channels 1 d

    Hello

    I have a vi that eventually writes some data to a log (.txt) file.  In the data that are written, there are a few tables.  In a particular section, I have three arrays of strings that I try to handle it with no luck.  Here is an example of what I have now, and subsequently, where I want to be:

    Present:

    x 1

    x 2

    x 3

    Y1

    Y2

    Y3

    Z1

    Z2

    Z3

    Desire:

    x 1 y1 z1

    x 2 y2 z2

    x 3 y3 z3

    Where x, y and z represent the three tables of sepreate channels.  These tables is then concatenated with other data to generate the log file.  It seems that no matter what I do (build, transpose, index, etc...) I still end up with the vertical arrangement in my log file - I'm sure I'm overlokking something trivial, but it's deceiving me right now.

    I cannot post my code because of security, but will provide any more detais needed.  Thanks in advance.

    I think you are looking to do a table build followed by a transposition.

    Your build array must have 3 entries.

    Feed it to X, Y and Z and you should get

    x 1, x 2, x 3

    Y1, y2, y3

    Z1, z2, z3

    Hit this result with the conversion and you should get

    x 1 y1 z1

    x 2 y2 z2

    x 3 y3 z3

    What do you use to write to the log file?

Maybe you are looking for

  • Displays only information and not that I sent to my sent folder

    I need to see who I sent my email to let me know, it's me, but I don't know how to change the settings

  • Email spellcheck

    When you write an email, I use my spell checker to make sure that everything is correct. He returns with "this language is no longer available for spell checking. his English.   What is the problem here.

  • Unable to display the log file in windows 7

    Hi all for all of you who are familiar with the text game, I use customer gMUD a certain game. gMUD is able to record activity as a document that is readable by microsoft Notepad. so, one evening I played and connected my activity where the customer

  • 6520 printer Assistant

    Just installed a using 6520 win 8.1 64bits dowlnoaded 6520 soaftware disc and line printer assitantt appeara of icon on my desktop but when I click on open nothing happens What can I doi to get this working? f

  • Live the regular shape path (Ray)

    Hi, can someone help me why I consider this dialogue whenever I try to go (via the path Selection tool) a stingray? This does not happen with other forms. THX!