How to exit

Hello

I have two columns A, B. How to reach the output like below:

A | B (10-5)

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

5. (10-5) = 5

2. (5-2) = 3

2. (3-2) = 1

1. (1-1) = 0

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

That is to say 10 = preset value

Thank you

Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

994122 wrote:

Thank you chris, but I don't want to hardcode 10 value.

My requirement is

Data in the table

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

A |  B |

----|------|-----

5.      |

2.      |

2.      |

1.      |

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

Expected results

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

A |  B |

-----|-------

5.  5

2.  3

2.  1

1.  0

The average needs, 1st rank in the B value is 5 + 2 + 2 + 1 = 10 now 10-5(first row value in the A)

At the top of column b, the calculation is like sum (column A) - first value in column a.

between 10-5 = 5

In the second row in column b, the calculation is as sum (column A) - 2nd value in column a.

2 + 2 + 1 = 5 IE 5-2 = 3

......

.....

etc.

It is only a small modification:

1 with testdata until)

2 select 5 A, B of all null double union

3 select null from union double every 2

4 Select null from union double every 2

5. Select 1, the double null value

6)

7  --

8. Select

9 a

10, sum (a) over()

11 - sum (a) over (order by a desc rows unbounded preceding) b

12 of testdata

13 * order by a desc

>/

A          B

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

5          5

2          3

2          1

1          0

Or semantically the same thing but taking your condition more literally:

1 with testdata until)

2 select 5 A, B of all null double union

3 select null from union double every 2

4 Select null from union double every 2

5. Select 1, the double null value

6)

7  --

8. Select

9 a

10, sum (a) (any order by a desc of lines between the current line and unbounded following)

11 a and b

12 of testdata

13 * order by a desc

A          B

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

5          5

2          3

2          1

1          0

Finally

1 with testdata until)

2 select 5 A, B of all null double union

3 select null from union double every 2

4 Select null from union double every 2

5. Select 1, the double null value

6)

7  --

8. Select

9 a

10, nvl)

11 sum (a) over (order by a desc ranks between 1 next and unbounded following)

12, 0) b

13 of testdata

14 * order by a desc

>/

A          B

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

5          5

2          3

2          1

1          0

Tags: Database

Similar Questions

  • How to exit safe mode in windows 8.1

    I entered in the Mode without fail my desire TS 15 running windows 8.1 to correct some problems with my Norton software and now I can't understand how to exit back to the normal mode.  Internet is off in safe mode (even though I chose the mode safe mode with networking) so I can run any of the resolutions & assistance.  Someone knows how to do this?

    Nanna,

    Welcome to the HP Forum.

    Try / review

    Control Panel > display icon > Administrative Tools> System Configuration >

    Boot Tab > UNCHECKstartup

    Restart/ reboot the computer and log in

    OR

    A different path to the same place:

    ·         Start Notepad and let it boot mode safe

    ·         Open a session

    ·         Windows key + R(open the run window)

    ·         Type msconfig

    ·         Opens the System Configuration Menu > tab click on Boot

    ·         REMOVE the check mark next to startup > Applyto save

    ·         Restart/ reboot

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

    In addition, you could do your router security is set to

    AES encryption type

    and

    WPA2-Personal security type

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

    For later, it's very useful to have, and it is easy to set up.  I did it.

    Safe mode can easily be added to the start screen.

    How to add 'Safe Mode' to the Windows in Windows 8 boot manager and 8.1

    From:
    Features of Windows 8 - a Quick Tour

    Click on the Thumbs-Up Kudosto testify and say thank you.

    While I strive to reflect best practices of HP, I do not work for HP.

  • How to exit safe mode?

    How to exit safe mode. New for this survey

    Original title: Mr. raymond scott

    From Internet Explorer

    Hello

    If does not restart the computer in normal mode (not sure) try this...

    Start > run (or Windows key + r), type msconfig, and then press ENTER.

    On the general tab, select Normal startup, click OK, and then restart.

    Don

  • AT300 - how to exit safe mode?

    My tablet to 300 went into safe mode.
    1: how to get out safe mode
    2: What safe mode made for my Tablet

    A big thank you to all those who can help you

    Dave

    Hello

    You can start the Android device in safe mode to troubleshoot your device.
    For example, if you are affected by plant, crashes or problems of battery life, you can boot into safe mode and see if the problems still occur there. Safe mode, you can uninstall misbehaving third-party applications.

    To exit safe mode, press the power button, select turn off and restart your machine in normal mode

  • How to exit the application and jump to the top any screen battery by single click?

    Hello

    for example,.

    My application contains some screen battery and train to do a task,

    the user now wants to exit the application and go to the blackberry icon page.

    How can I do that.

    Thank you best regards &,.

    Narendra Shekhawat.

    Hello

    System.Exit (0);

    or UiApplication.getUiApplication.requestBackground ();

    Kind regards

    Jochen

  • How to exit an app in the simulator of Playbook Tablet?

    Hi, I have just compiled the sketchpadstandard in an application and have it currently running in the Simulator.  How do I exit/quit out of the app in the Simulator?

    I found my answer.  There are 'slide' to the top of the black bar at the bottom of the Simulator.

  • 10.1.4 update blocks Acrobat Pro, how past exit Code 6?

    I'm on Mac OS with CS5.5 10.7.5. Everything worked perfectly until the installation of the update free Acrobat 10.1.4.  Since then my Acrobat Pro crashes seconds after their opening.  I reinstalled it - dozens of times, since originally CS5.5 disc (also in secure boot mode), but still get the same error message that it did not install completely: Exit Code 6.

    Suggestions on how to fix this would be appreciated!

    Thank you in advance.

    Acrobat cleaning tool

    Creative Suite cleanup tool

    Mylenium

  • How to exit properly ChangeDetection thread?

    I call the function ChangeDetection of the NI USB-6525 with C in a C++ program code:

    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateDIChan (taskHandle, "Dev1/port1/$line0", "", DAQmx_Val_ChanPerLine));
    DAQmxErrChk (DAQmxCfgChangeDetectionTiming(taskHandle,"Dev1/port1/line0","Dev1/port1/line0",DAQmx_Val_FiniteSamps,1));
    DAQmxErrChk (DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_ChangeDetectionEvent,0,ChangeDetectionCallback,));
    DAQmxErrChk (DAQmxGetTaskNumChans (taskHandle, & numLines));

    DAQmxErrChk (DAQmxStartTask (taskHandle));

    As far as I understand, this creates a separate thread that defines the USB box - 6525 ChangeDetection mode. When the unit detects a signal change, the C++ program calls a function (called ChangeDetectionCallback() in this case), which runs in its own thread (or perhaps the same thread, but in any case not the thread used to call the above code). It is explained here and is due to the argument of '0' in DAQmxRegisterSignalEvent().

    What I want to know is: while this thread is running (either one created by one of the above functions or whoever runs ChangeDetectionCallback() in), it is ok to quit the program? It could be any problem resulting from resources unfreed, for example? Are there measures should I take to make sure that everything completes successfully, as making sure always to call DAQmxStopTask() and DAQmxClearTask() before you quit the program?

    Hello

    If you click Exit, you must release all resources and the sons who have served in your program.

    You mentioned the right features, if you work with DAQmx, you must stop and cancel the task. If you work with threads (Thread Safe queue for example), it must be released, too. If you opened the file for playback of /writing, you must close them to provide the means and the free memory again.

    brinmr wrote:

    I call the function ChangeDetection of the NI USB-6525 with C in a C++ program code:

    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateDIChan (taskHandle, "Dev1/port1/$line0", "", DAQmx_Val_ChanPerLine));
    DAQmxErrChk (DAQmxCfgChangeDetectionTiming(taskHandle,"Dev1/port1/line0","Dev1/port1/line0",DAQmx_Val_FiniteSamps,1));
    DAQmxErrChk (DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_ChangeDetectionEvent,0,ChangeDetectionCallback,));
    DAQmxErrChk (DAQmxGetTaskNumChans (taskHandle, & numLines));

    DAQmxErrChk (DAQmxStartTask (taskHandle));

    As far as I understand, this creates a separate thread that defines the USB box - 6525 ChangeDetection mode. When the unit detects a signal change, the C++ program calls a function (called ChangeDetectionCallback() in this case), which runs in its own thread (or perhaps the same thread, but in any case not the thread used to call the above code). It is explained here and is due to the argument of '0' in DAQmxRegisterSignalEvent().

    What I want to know is: while this thread is running (either one created by one of the above functions or whoever runs ChangeDetectionCallback() in), it is ok to quit the program? It could be any problem resulting from resources unfreed, for example? Are there measures should I take to make sure that everything completes successfully, as making sure always to call DAQmxStopTask() and DAQmxClearTask() before you quit the program?

    Best regards, Fabian

  • How to exit while loop with delay schedule?

    I have a pretty heavy program that iteratively takes a series of measures from a number of channels using a variety OR-Switch and OR-DMM screws that I assembled as a result of various examples and several help pages. Each channel is sampled once during each iteration with data to be saved in a text file for later analysis, after it is imported into Excel. I added to the screen 'real time' indicators and charts to see what looks like running data.

    Each iteration is performed using a While loop with a delay timer, even if a previous version, I used a timed loop. Measures for the series of channels are collected with a loop For inside the While loop. The loop For includes screws which:

    1 cut the channel and wait as debounce.

    2 Initializes the DMM and passes the configuration information.

    3. wait for a while to make sure that the DMM is set.

    4. measure.

    5. close the DMM.

    6 disconnect all the switches.

    The terms of the election of the channels is ends in 15-20 seconds and I am currently collecting data every two minutes, so he spends "wait" time "collection". Each iteration of the loop For initializes and closes the DMM to avoid the hot switch.

    Other components of the program are configuration setting controls, etc. (in front of the While loop), a "current measurement" indicator and a writing-text inside the loop file operation For, several indicators of the iteration (inside the While loop, but outside the loop For) and a bunch of operations related to the grouping and table that provide graphics of groups of time vs measures.

    I don't know there are more elegant ways to perform many functions that I do and I'm not posting the VI here because I want to concentrate on what I know, it's a big problem with my program (for now!) - I can't figure out how to get out of the While loop. I tried the combinations of Boolean control, its conditions of latch and Stop / continuous if true to nothing does not.

    I want a 'Stop' button that ends the While loop, at the next opportunity, but it is not working properly, I think, because the stop button does not play with good timing, because the program runs either the loop For or the time delay at the beginning of the While loop. 'Next opportunity' can mean 'Immediately', 'at the end of the next iteration of the loop,"or"at the end of the next delay schedule." I think that if I get one of these scenarios to work, I can get an any of them to work!

    Help, please!


  • After updating to SP3, I have to restart. When I do that my computer goes to a safe mode. How to exit safe mode? I have to do a system restore to fix.

    I'm going to an auto to install update. The installation is correct. But when I do a restart, he comes back in a safe mode. I don't know what to do.

    Any help is greatly appreciated.

    I'm sorry, I thought you were all the same team. One of the members of the staff of microsoft helped me. I had to disable the 'pilot' and I had to change a valur at 4. After that, it works perfectly.

    In response to your earlier questions on Norton and McAfee. Yes thery have been installed with the computer, but I removed the programs. Whenever I tried to download SP3, I got in trouble. But even if I did a system restore. Everything still works from before. Not sure how many times I did it. But I wanted to finally come to a duty case or get a new computer.

    Thank you very much for your help and support.

    Sincerely

    R Q POWERS

  • How to exit a media SD of the computer disc?

    I have a hp pavilion p6 series and have downloaded files from a SD disk and cannot eject the disc.  How do I do that?

    Oh I take cela back it didn't worked, thank you!

  • How App exit/Quit in C++

    I now use exit (0) in c ++ which is called from my exit QML button.  Problem is sometimes the application crashes out, but not always.  Is the best way to do it or should I just remove the button and allow the user to use actions to close the application?

    Thank you.

    in QML:

    Application.Quit ();

    in C++:

    Application::instance ()-> Exit (0)

  • How to exit the camera application properly

    I start the camera application by doing this

    Invoke.invokeApplication (Invoke.APP_TYPE_CAMERA, new CameraArguments());

    The camera app starts. I take a picture.

    I am on a 9000 "BOLD".

    You use the camera you will find that you can not close the app until you get rid of the image sets that you have just taken.

    For example
    take photo

    Picture is a static view of the screen

    If you press close (close menu) it does ' t go away.

    If you press the ESC key, then press close he disappears.

    now in my application, I need to simulate this but I can't seem to get out

    I want to launch the application.

    Press the trackball to take the picture

    Save the photo.

    Then exit.

    I inject

    EventInjector.invokeEvent (new EventInjector.KeyEvent (EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 10));

    EventInjector.invokeEvent (new EventInjector.KeyEvent (EventInjector.KeyEvent.KEY_UP, Characters.ESCAPE, 30));

    And it closes ok

    BUT... when I opened the camera (for the second time) the image is on the screen, the last shot.

    So, it didn't really come out. The user must press the ESC key stupid and then take another picture.

    Any ideas?

    Thank you

    You test this in the simulator of BlackBerry or on a real BlackBerry "BOLD"?  What version of BlackBerry device software you are using (beneath Options, about)?  Is that you inject events for all the actions in your list or just the ESC key to exit?

  • How to exit the Mobile with Lightroom?

    How do you get Lightroom Mobile? I've upgraded LR and wound up in Lightroom Mobile. I can't at all my images in LR. I just want to get rid of it and go back to my usual LR!

    Try to disable synchronization for mobile.

    Click on your identity plate and disable synchronization if selected.

    In addition, you can define what shows the identity plate by clicking right on it.

  • How to exit mode full screen on a Tablet PC to operate Win8.1 and no physical keys?

    Accidentally I clicked on the option Full screen but now the icon Menu not coming back and I not minimized nothing I don't know to return to the mode.

    Found your solution! had the same problem today. Swipe to the left to the right side to bring up the menu of charms (it has the settings, power, start button ect.) at the bottom right you will see six buttons, one is the virtual keyboard. success for the, now you have a key board!

    bottom left, there will be another button on the keyboard keyboard, allows you to change the style of keyboard in order to get the key of f. you want one with the most of keys and the "FN" (function I think) button at the bottom right. Click on this button FN and you'll change your keys to f-Number buttons. Press F11 and you're there.

    Sorry, it's so complicated, but it works. I post a vidieo, but I did not have this ability.

Maybe you are looking for

  • Re: Need to display driver just for my atellite L300D

    Hello I have a problem. I installed new Windows Vista 32 bit on my laptop and want to download all the required drivers but I m missing the drivers for the graphics card and net.I tried to download them from the download page, but could not do this.

  • Unsort definitively the properties in the dialog editor

    I have all accessories in alphabetical order in the Toolbox of properties in the dialog editor. I can uncheck sort option in content dropbox, but when I restart the editor-in-Chief, I re-sort the accessories. Please, how can I have unsorted accessori

  • Trigger start CTR - USB6343 error

    Hi- A digital pulse of a device in my system is connected to the door of CTR0 (PFI9). CTR0 is used as a quadrature encoder. My code road PFI9 to the door of the CTR1 (PFI4) and also defines PFI9 as a trigger to start for CTR3. CTR3 is set to generate

  • When I try to download my updates, they will not download

    Every time I have try and download my updates, which they continue to not download

  • How can I fix the errors in my event veiwer

    My laptop runs so slow Ive defragmented memory but it only lasts about a minute and back % 21 free, Ive cleaned the defraged files & programs obsolete registry what else can I do Internet explorer freezes and crashes. I should go do a restore or reco