Calculation 3 records and other documents

I'm under the table with 10000 lines
for example, I added only 11 lines
I need fill the value r square for each (Column) has 3 rows and so on
If the remianing records are less than 3, so I need to calculate the remaining, those also


What I need like below

A BEGINNING TEACHER AVERAGE R_SQUARE END

--------------------------------------------------------------------------------
1 0 0.1 159 159
2 0.1 0.2 159 168
3 0.3 0.2 179 159 0.25
4 0.1 0.2 250 300
5 0.2 0.3 320 250
6 0.4 0.3 250 380 0.627906977
7 0.2 0.3 388 379
8 0.3 0.4 379 388
9 0.5 0.4 388 400 0.006756757
10 1.5 0.6 499 500
11 0.6 0.5 1 448 420


R - square-> REGR_R2 (AVERAGE, TEACHER)


Select one
beg
end
teacher
average
, case mod (a, 3) when 0 then regr_r2 (average, teacher) (any order by a line between 2 previous and current line) end r_square
of tableaa

A BEGINNING TEACHER AVERAGE R_SQUARE END
-----------------------------------------------------
1 0 0.1 159 159
2 0.1 0.2 159 168
3 0.3 0.2 179 159 0.25
4 0.1 0.2 250 300
5 0.2 0.3 320 250
6 0.4 0.3 250 380 0.627906976744186
7 0.2 0.3 388 379
8 0.3 0.4 379 388
9 0.5 0.4 388 400 0.00675675675675676
10 1.5 0.6 499 500
11 0.5 0.6 420 448 < does not appear in Acrobat one >


create table TABLEAA
(
A NUMBER,
PLEASE THE NUMBER,
NUMBER OF END,
NUMBER OF TEACHER,
AVERAGE NUMBER
)
;


insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (10, 1.5,.6,, 499, 500);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (1, 0,.1, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (2,.1,.2,, 159, 168);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (3,.2,.3, 179, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (4,.1,.2, 250, 300);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (5,.2,.3, 320, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (6,.3,.4,, 250, 380);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (7,.2,.3, 388, 379);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (8,.3,.4,, 379, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (9,.4,.5, 388, 400);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (11.5.6, 420, 448);
commit;





Thanks in advance

Hello

You can set the column to r_square like this:

,      REGR_R2 (average, prof) OVER ( ORDER BY         a
                                               ROWS BETWEEN  CASE
                                   WHEN  MOD (a, 3) = 0
                                   THEN  3
                                   WHEN  a = ( SELECT  MAX (a)
                                                  FROM    tableaa
                                          )
                                   THEN  MOD (a, 3)
                                   ELSE  0
                                           END          PRECEDING
                            AND         CURRENT ROW
                        ) AS r_square

If you're only computer regr_r2 on 1 row (i.e. the current line more 0 previous lines), it returns NULL.

It may be more efficient to determine which is the last row of a subquery, possibly using ROW_NUMBER () OVER (ORDER BY a DESC).
Then, in the main query, you won't have to repeat the scalar subquery (SELECT MAX (a) tableaa) on 2/3 of the lines.

Published by: Frank Kulash, August 19, 2009 14:25

Tags: Database

Similar Questions

  • By opting for the local account affects the current files and other documents are store in the pc.

    I have windows 8 is installed in my desktop pc

    I want to move my account to GO to THE LOCAL because of user setting I m tried to synchronize my app Mail for new emails and other stuff his watch still unavailable then, opting for the account local affect current files and other documents are stored in the pc at this moment before I spend.

    Hello

    Passage of the account Microsoft local account will not affect your personal documents saved on the computer.

    Reference: http://support.microsoft.com/kb/2782145

    It would be useful that you could provide more information on the problem faced with synchronization.

    -What is the exact error you get when synchronization Mail app and other apps?

    -Do you use all parameters of proxy to access the internet?

    -Remember to make changes before the show?

    -What anti-virus software is installed on the computer?

    If you encounter the problem of synchronization with all applications, then I ran the http://download.microsoft.com/download/F/2/4/F24D0C03-4181-4E5B-A23B-5C3A6B5974E3/apps.diagcab Apps store

    Navigate through the steps mentioned in http://windows.microsoft.com/en-us/windows-8/what-troubleshoot-problems-app

    Check if you have any proxy enabled. If so, then delete it.

    a. open Internet Explorer.

    b. click on tools and select Internet Options.

    c. click on connections.

    d. click on LAN settings.

    e. remove the check mark next to proxy server.

    f. click OK and check if you are able to synchronize emails.

    If none of the steps work, try to remove the account from the messaging application and add it again and check.

    Go through http://windows.microsoft.com/en-IN/windows-8/mail-app-faq

    Hope this information is useful. Let us know if you have any questions.

  • Work with certain records and other people tool tip does not...

    Hi guys,.

    As you can see in the attached picture, I guess that I have correctly configured the ToolTip. Yet, it works with folders and others do not.

    Pls have one similar to this image and advice,

    http://www.9M.com/upfiles/e3w59634.PNG


    Thanks in advance,

    Fateh,
    I think the tooltip plugin that you use to display the ToolTip is probably lift some internal exception and for this reason it is return NULL (just doubke quotes)
    It would be best to contact the author of the plugin that someone else trying to debug the problem plugin.

    A few other comments

  • In order to display the ToolTip, you need a new application server (using Ajax) which I think is totally useless since you have / can have the same data in the page itself, without losing performance.
  • Another related point, which is since you're substring'ing the ToolTip text, you are losing out of text searched on this column. If you have included the content somewhere in the report (even in a row/column elementhidden by JS), the search might work.

    My suggestion would be to include the full column in some item hidden in the same column itself as well as the text of substr'inged show and create a ToolTip based on the hidden element (if your plugin has such a feature, use)

    For example

     SELECT ..
       , ''||description||''||substr(description,1,100) description
       ..
    

    The span element that is hidden in the same column has the full text you can use in the ToolTip.

    You can also view the full text in a column and still hiding using CSS

    SELECT ..
       ,description description_full
       ,substr(description,1,200) description
     ..
    

    The description_full column now has the full text, make sure that it cannot be hidden by a user in the report, by unchecking the checkbox "Hide the option" column

    And add the following line to the page header

    <style>
       th#DESCRIPTION_FULL, td[headers^="DESCRIPTION_FULL"] {
    display:none
      }
    </style>
    
  • Calculation 3 entries online and other documents

    Thanks in advance

    When I use the following query (1) I get accurate results for all 3 rows
    When I use query2 I do not get results for all 3 rows

    SELECT A.* 1).
    REGR_R2 (average, teacher) OVER (ORDER BY one
    LINES BETWEEN CASES
    WHEN MOD (a, 3) = 0
    THEN 3
    When a = (SELECT MAX (a)
    OF tableaa
    )
    THEN MOD (a, 3)
    0 OTHERWISE
    END PREVIOUS
    AND CURRENT ROW
    ) AS r_square


    OF tableaa one
    -where a <>3
    ORDER BY;

    A BEGINNING TEACHER AVERAGE R_SQUARE END
    --------------------------------------------------------------
    1 0 0.1 159 159
    2 0.1 0.2 159 168
    3 0.3 0.2 179 159 0.25
    4 0.1 0.2 250 300
    5 0.2 0.3 320 250
    6 0.4 0.3 250 380 0.164520715073488
    7 0.2 0.3 388 379
    8 0.3 0.4 379 388
    9 0.5 0.4 388 400 0.218256852125604
    10 1.5 0.6 499 500
    11 0.6 0.5 420 448 0.953783619429657

    (2) SELECT a.*,
    REGR_R2 (average, teacher) OVER (ORDER BY one
    LINES BETWEEN CASES
    WHEN MOD (a, 3) = 0
    THEN 3
    When a = (SELECT MAX (a)
    OF tableaa
    )
    THEN MOD (a, 3)
    0 OTHERWISE
    END PREVIOUS
    AND CURRENT ROW
    ) AS r_square


    OF tableaa one
    When a <>3
    ORDER BY;

    A BEGINNING TEACHER AVERAGE R_SQUARE END
    -----------------------------------------------------------
    1 0 0.1 159 159
    2 0.1 0.2 159 168
    4 0.1 0.2 250 300
    5 0.2 0.3 320 250
    6 0.4 0.3 250 380 0.20518925851521
    7 0.2 0.3 388 379
    8 0.3 0.4 379 388
    9 0.5 0.4 388 400 0.218256852125604
    10 1.5 0.6 499 500
    11 0.6 0.5 420 448 0.953783619429657


    create table TABLEAA
    (
    A NUMBER,
    PLEASE THE NUMBER,
    NUMBER OF END,
    NUMBER OF TEACHER,
    AVERAGE NUMBER
    )
    ;

    Fast loading TABLEAA...
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (10, 1.5,.6,, 499, 500);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (1, 0,.1, 159, 159);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (2,.1,.2,, 159, 168);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (3,.2,.3, 179, 159);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (4,.1,.2, 250, 300);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (5,.2,.3, 320, 250);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (6,.3,.4,, 250, 380);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (7,.2,.3, 388, 379);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (8,.3,.4,, 379, 388);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (9,.4,.5, 388, 400);
    insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
    values (11.5.6, 420, 448);
    commit;

    What:

    SELECT d.*
    FROM   (SELECT c.*, last_value(r_square ignore nulls) over (order by rn_desc) r_square_val
            FROM   (SELECT a.*,
                           REGR_R2 (average, prof) OVER (ORDER BY rn
                                                         ROWS BETWEEN CASE WHEN MOD (rn, 3) = 0
                                                                                THEN 3
                                                                           WHEN rn_desc = 1
                                                                                THEN  MOD (rn, 3)
                                                                           ELSE  0
                                                                      END  PRECEDING
                                                               AND CURRENT ROW) AS r_square
                    FROM   (select b.*,
                                   row_number() over (order by b.a) rn,
                                   row_number() over (order by b.a desc) rn_desc
                            from   tableaa b
                            where  b.a != 3) a) c) d
    where trunc(r_square_val, 2) = 0.01
    ORDER BY  d.a;
    
  • I caused records and other icons to disappear from my office. Please help me to find and recover them.

    After having inadvertently highlighted a group of icons, instead of only the expected, on my desk, I dragged all of them to try to put them in a folder on my desktop.  The destination folder and icons that I dragged on, as well as, it seems, a little more icons all disappeared.  Have a solution that I can use?  Thank you.

    Have a solution that I can use?  Thank you.

    I could do this:

    1. Open Windows Explorer.
    2. Open the C:\Users\Liz folder.
    3. Right click on the Desktopfolder.
    4. Click on the line to restore the previous version.
    5. Follow the prompts to set the desktop back to its previous state in good health.
  • Records and other windows are automatically deselected AND rattling?

    This just started today, I have not installed anything changed recently, not all parameters, not doing something unusual. I ran virus checkers, etc. anything.

    Randomly in short intervals, Windows is automatically any window deselection I currently have open - file, browser, Editor, no matter. Then just after, there are several sounds, almost in a regular pattern, such as «click, click, click...» Click (pause)... "so there will be 1 or 2 minutes where everything works normally and then the cycle repeats. Clicks are the ones you get when you go forward or backward in the file browser.

    It's almost as if my mouse is automatically by clicking on the desktop. Open window is deselected, and I have to click in the window that I just used. It's so weird, but it's the best description of what is happening.

    I even changed mouse from my wireless to a wired thinking there was something wrong with it, but I have the same problem. I put on as well.

    Help

    Hello

    I suggest that you follow the steps below and check them off if they help.

    Step 1:

    The issue may be related to malicious software, you should download, install and use the Microsoft Security Scanner to remove the malicious software.

    Step 2:

    If this does not work, turn your computer in safe mode and check if the problem persists.

    Step 3:
     
    If it works fine in safe mode, there must be a third party software that is causing the problem to occur, this is why I suggest you put your computer in a clean boot state.
     
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135

    Note: Put your computer in normal mode (step 7).
  • Work records and other installation questions

    Hello, I am a user of long date first but have never been involved in the installation program. I decided to start making a personal video editing on my gaming computer and met with a few questions.

    The biggest one I have is with the work disk configuration. I read the help doc about 10 times and google all combinations of words I can think, but I'm still not sure how should I configure these for my setup.

    I have the first Pro CS5 installed on my C:, which is a 128 GB SSD

    For storage, I have 4 1 than to disks in Raid 5, yes 2.72 TB of total storage.

    How I want to configure my "scratch disks" for the best possible performance?

    Question 2: It could be linked to the work disk configuration, I'm not sure, but something that I've always wondered. What disk does save my projects to in this configuration? Is how important it? Then, I want to make my final video in this same folder or on another drive?

    Question 3: I a currently GTX 460 graphics card and enjoy benefits of CUDA acceleration. I have looked at adding a second in SLI for games purposes, but have read that the Mercury playback engine is not compatible with SLI. Does this mean that it will still work with a single card and I see no advantage in the first, or all CUDA acceration will cease?

    Thanks guys, I appreciate the help.

    First of all, SLI is not supported by PrPro, so it will do you no good and may well get in the way.

    You have only two HARD drives, SSD and RAID, so you don't have much choice there.

    Given the configuration of your I/O, I wouldn't worry about the ultimate in performance and just locate your assets, your projects and your Scratch disks on the RAID.

    In a more perfect world, I would say to separate the assets of the project, but it would mean another HARD drive (actually a good supplement, as a configuration 3 x is better than a configuration of 2 x).

    In a more perfect world, you would separate your assets to a HARD drive, your projects to another, your discs scratch to another and exports to another one.

    The foregoing has one drawback - household later. I create a new folder for all projects and locate my disks scratch that. This allows the elimination of this project, and it takes all the files from Scratch with her drive. However, for optimal performance, separating might get you a few points on the PrPro Benchmark scores, but doubt that you never notice it, more you still have work to do, when you delete a finished project. Your call.

    Good luck

    Hunt

  • I can't send photo attachments and other documents from my outlook account. I have to use a different Web-based e-mail address. It's not because the files are too big. Any ideas how to fix this - I am confused.

    It is an intermittent problem - the message says something like the computer can not find attached messages always want to send the email. I can see the attachments so I do not understand why it does this.
    all ideas

    It is an intermittent problem - the message says something like the computer can not find attached messages always want to send the email. I can see the attachments so I do not understand why it does this.
    all ideas

    1. when it happens again, temporarily disable your anti-virus mail option electronics scannibg. Try to send attachments again.
    If it works, that's your problem.

    2. Please see if one of your settings match the following:
    Open Outlook > tools > Options > Mail Format tab, in the compose in this message format: set as HTML > OK

    t-4-2

  • Lost my folder list and other e-mail accounts

    From one day to the next the computer restarted. When mail is started it goes directly to show onoly Inbox to my main account. I have 4 accounts. View lost all records and other email accounts. I searched through all the settings and everything looks okay.
    At my email was hijacked somehow...? and how do I know?

    The bar of Menu select View-presentation-folder pane for turn on the folders pane.

    No Menu bar? Press the ALT key.

    If the folders pane is already turned on, move your mouse on the left margin of the window, and when it turns into a double arrow head, click and drag to the right to reveal the files pane.

  • Delete record and display of value in other documents

    Hi all

    I use 11.6 Toad, I don't know if my subject really clarifies what I need assistance.  I'm not able to join (if that's the right solution) display below data.  The record that contains the value 98,38 should appear in other documents and registration with this value should not display.  Can someone help me with this, thanks for reading also.

    SELECT THE SID,

    ORGANIZATION_ID,

    ORGANIZATION,

    PERMIT_NUMBER,

    GAME_DATE,

    BASIS_FOR_FEE,

    ADDAMOUNT,

    CHGSDESC,

    PBPAYAMT

    OF ABCGAMING_PRE_POSTING_VW

    WHERE ORGANIZATION = "Test of bombers".


    SID ORGANIZATION GAME_DATE BASIS_FOR_FEE ADDAMOUNT CHGSDESC PBPAYAMT PERMIT_NUMBER ORGANIZATION_ID

    247741 243480 bombers test 865 644 3/3/2014 0 0

    247750   243480                       Bombers Test          644                                                     0                       0                                          98.38    

    247740 243480 bombers test 644 3/6/2014 162,5 0 0


    I would like the results to look like underneath, the PBPAYAMT and the CHGSDESC should appear in the other files.  But also to remove the extra record without Game Date, basis for feesand Addadmount values.


    SID ORGANIZATION GAME_DATE BASIS_FOR_FEE ADDAMOUNT CHGSDESC PBPAYAMT PERMIT_NUMBER ORGANIZATION_ID

    247741 243480 bombers test 865 644 3/3/2014 0 98,38

    247740 243480 bombers test 644 3/6/2014 162,5 0 98,38

    Thanks for the reply from Frank,

    This is my first post since the site has been updated. I'm sorry do not follow the Protocol appropriate seriously. I can extend what you have provided.  Thank you for the statement, this will help me.

  • Is it possible to get clip names and additional descriptions (and other metadata) in a report? The number, .xls or some other document available?

    I have about 12 tablespoons of images recorded on several projects. Each clip has a description added to it. I'm trying to find a way to search for a specific content easier. Since so much information was laboriously on slot form of description of metadata, it would be great to be able to use it. Which brings me to the question -

    Is it possible to get clip names and additional descriptions (and other metadata) in a report? The number, .xls or some other document available?

    Thank you!

    Karim.

    one way is to highlight all the media/bins in the project Panel and from the menu, export the batch list. This will create a .csv text file.

    There is also this option in another post, but do not know how it works. First Pro CC - how can I export metadata custom in Excel?

  • Removal of Documents and data and other

    Material: iPhone 5

    Software: iOS 9.2 (at day, on this day)

    I have an old iPhone 5 that I'm redirecting as music player. I did a thorough cleaning ("erase all content and settings') of the device before you start. I copied the music on it (via iTunes on my MacBook). After a few moments, I noticed that the use of "Documents & data" is now about 900MB, and 'Other' is about 350 MB. What is this, and how do I empty?

    There are no installed applications (other than those which are by default on the phone). He has been in flight since the reset mode (but with WiFi and Bluetooth on), and it is an inactive SIM (got a new with my new phone, so this SIM has been disabled by my company). The only active account on my Apple account. No email, social media, etc. accounts are configured. There is no photos, videos, podcasts, or anything else on it. The use of the storage (under 'manage storage') shows some nominal storage by default applications (from 16 KB to 2 MB) and there is nothing further stated within each application.

    Then... What is only 1.25 GB of things which are appeared unexpectedly? And more importantly, how can I get rid of him? Other than music files (and the music app), there is no other applications or data on the iPhone that needs to be saved.

    Thank you.

    'Other' data the iOS itself, as well as any app data, messages or email.  350 MB is low, so it's mainly the iOS.  The Documents and the data is most likely the work of art album data, and associated playlists etc.

  • I have a HP Vista. My default Word in WordPad documents. How to make spelling and other bars and how to convert to the basic Word.

    I have a HP Vista. My default Word automatically with WordPad documents. It's terrible! How to spell check and other bars and how to convert to Word base. Thank you.

    Microsoft Word is installed?

    If so - what version (start it manually.)

  • Error with Facebook and other web pages; document. Body' is null or not an object

    Original title: error line: 19 tank: 23004 error line: 20 cha:124

    document. Body' is null or not an object line: 19 tank: 23004... object doesn't support this property or method line: 20 char: 124... I get these errors on facebook and other web pages help me please!

    Hello

    IE - Tools - Internet Options - Advanced tab - navigation on the article - check the BOTH Disable script
    boxes of debugging.

    Close and restart IE.

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

    Follow these steps to remove corruption and missing/damaged file system repair or replacement.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to fix the system files of Windows 7 with the System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Then run checkdisk (chkdsk).

    How to run check disk in Windows 7
    http://www.SevenForums.com/tutorials/433-disk-check.html

    ========================
    ========================

    Tips for solving problems with Internet Explorer
    http://Windows.Microsoft.com/en-us/Windows7/tips-for-solving-problems-with-Internet-Explorer

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

    Methods more troubleshooting for Facebook and other questions of the site, if needed:

    Try to add to your trusted sites in IE - Tools - Internet Options - Security - Trusted Sites.

    https://www.Facebook.com/

    http://www.Facebook.com/

    http://www.Facebook.com/login.php

    http://www.Facebook.com/Farmville

    What antivirus/antispyware/security products do you have on the machine? Be one you have
    EVER had on this machine, including those you have uninstalled (they leave leftovers behind which)
    may cause strange problems).

    If no joy there's something blocking perhaps.

    Start - All Programs - Accessories - System Tools - IE with no Addons - what works best?

    IE - Tools - Internet Options - Advanced - tab click on restore, and then click Reset - apply / OK

    IE - Tools - Internet Options - Security tab - click on reset all default areas - apply / OK

    Close and restart IE or IE with no addons

    not better?

    IE - tools - manage Addons (for sure disable SSV2 if she's here, it is no longer necessary but Java
    installs and it causes more questions - have you never update Java to go back in and turn it off again.) Search
    other possible problems.

    Windows Defender - tools - software explore - look for problems with programs that do not look
    right. Allowed are usually OK and "unauthorized" are not always bad. If doubt about a program
    ask about it here.

    Could not be a free - SpyBHOremover - BHO - standalone program, needs no installation, download.
    unzip and run - all are not bad, but some can cause your question (toolbars are BHO).
    http://securityxploded.com/bhoremover.php

    How to change, add or remove startup programs in Windows 7
    http://www.SevenForums.com/tutorials/1401-startup-programs-change.html

    Also get Malwarebytes - free - use as scanner only.

    http://www.Malwarebytes.org/

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

    Maybe using Compatibility Mode will help you.

    Introduction of compatibility view
    http://blogs.msdn.com/ie/archive/2008/08/27/introducing-compatibility-view.aspx

    http://www.Microsoft.com/Windows/Internet-Explorer/features/easier.aspx

    Some Web sites are not displayed correctly or work correctly in Windows Internet
    Explorer 8
    http://support.Microsoft.com/kb/956197

    Hope these helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • A document I had previously recorded on my flash drive. All of a sudden the paragraph symbol appeared at the beginning of each line in the document and in documents on flash drive

    Original title: Word 2003 Documents

    I was working on a document I had previously recorded on my flash drive.  All of a sudden the paragraph symbol appeared at the beginning of each line in the document and all documents on the flash drive.  In addition, it appears on every document in the my documents folder.

    Can anyone help?

    Google search:

    How do I turn off paragraph symbol in Word 2003

    "You should have a paragraph symbol button in the bar... click on this tool and formatting symbols will disappear."

Maybe you are looking for