How to return the lines after a selected line

Hi there, I need return the straight after that the condition I have is filled...

given the following table:

date col ID
123 Y 29/02/2013
123 X 27/02/2013
* 123 Y 26/02/2013 *.
123 Z 26/02/2013
* 123 X 25/02/2013 *.
123 Z 25/02/2013

I need a query that retrieves all rows that come immediately after col = 'Z' it is
123 X 25/02/2013
123 Y 26/02/2013

Any help would be appreciated,

Hello

Martel wrote:
Hi there, I need return the straight after that the condition I have is filled...

given the following table:

date col ID
123 Y 29/02/2013
123 X 27/02/2013
* 123 Y 26/02/2013 *.
123 Z 26/02/2013

The 2 highest ranks (and the 2 lines below, by the way) seem to have the same date. I guess there is something that you are not showing that puts unqmbiguously in the order listed.

* 123 X 25/02/2013 *.
123 Z 25/02/2013

I need a query that retrieves all rows that come immediately after col = 'Z' it is
123 X 25/02/2013
123 Y 26/02/2013

It's just that the analytic LAG function.

Any help would be appreciated,

Here's one way:

WITH   got_prev_col     AS
(
     SELECT     id, col, dt     -- DATE is not a good column name (id isn't so good, either)
     ,     LAG (col) OVER ( PARTITION BY  id  -- or omit PARTITION BY clause
                                ORDER BY      dt
                      )  AS prev_col
     FROM    following
)
SELECT     id, col, dt
FROM     got_prev_col
WHERE     prev_col     = 'Z'
;

I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data. For example, what makes one of the lines 26/02/2013 come in front of the other. Explain what id role plays in this problem. better yet, include a couple of different id values in the sample data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Tags: Database

Similar Questions

  • How to get the line object table View

    Hello

    I use Jdev 11.1.1.7

    My requirement is, there are two ways I can get lines in my logic, you're based getFilteredRows (RowQualifier) and vo.executeQuery () - on a specific condition or I should consider first or later...

    getFilteredRows() returns the line [], I need to find a way to make [Row] of the View object properly after ececuteQuery() on the VO... When I use vo.getAllRowsInRange () which returns only a single line, but what iterate the VO even, I see that there is more than one line... How can he get all the range of the VO table?

    Thank you

    You can set the size of the field-1?

    ViewObjectImpl (Oracle ADF model and Business 10.1.2 API components reference)before calling getAllrowsinRange?

  • How to return to Adobe after effects CC2014 of CC2015 under windows?

    How to return to Adobe after effects CC2014 of CC2015 under windows?

    Dave LaRonde wrote:

    You can have both versions on your machine... Although the 2014 version works a heck of a lot better.

    Maybe, maybe not. On my home machine, CC 2015 runs more smooth (and in fact, on some projects, makes faster - which makes no sense). I use it exclusively now, except for final rendering.

    And Yes, you can install CC 2014 (and CC and CS6) without uninstalling CC 2015. Link to Dave it says just like this one: How to find and install previous Version of Adobe Apps in CC 2015

  • How to draw the line under STROKE and fill of an object in illustrator cc? Ideas: D...

    How to draw the line under STROKE and fill of an object in illustrator cc? Any ideas ...

    Aleksandar,

    If I (put) understand it, you will need to divide the object. You can:

    (1) select the object and Ctrl / Cmd + C + F, and then remove the filling of the copy and the blow of the original;

    Draw 2) and drag the new piece down between Division 1 objects) in the layers palette, or select 1 copy) and Ctrl / Cmd + C + F + X + F or similar.

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • How to change the background color of selection of the selected item in the drop-down box of choice?

    How to change the background color of selection of the selected item in the drop-down box of choice?

    By default, the selection background color like 'blue', but if I want it to be "yellow" for example, how should I do?

    Thank you

    The id is applied by (I think) the skin of the ChoiceBox class. You don't need to define.

    You must apply the css in an external style sheet. You can apply the external style sheet to any parent of the box of your choice, or on-site (the most usual way to do it).

    Example:

    import java.util.ArrayList;
    import java.util.List;
    
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class ChoiceBoxTest extends Application {
    
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Example 2");
    
        final ChoiceBox choiceBox = new ChoiceBox<>();
    
        List tempResult = new ArrayList();
        for (int i = 0; i < 10; i++) {
          tempResult.add("Item " + i);
        }
        choiceBox.getItems().setAll(tempResult);
    
        VBox root = new VBox();
        root.getChildren().add(choiceBox);
        final Scene scene = new Scene(root, 300, 250);
        scene.getStylesheets().add("choiceBox.css");
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    
    }
    

    choiceBox.css:

    @CHARSET "UTF-8";
    #choice-box-menu-item:focused  {
     -fx-background-color: yellow ;
    }
    #choice-box-menu-item .label {
     -fx-text-fill: black ;
    }
    

    Post edited by: James_D

  • set_item_property changing the text, but how to return the original value

    Hi all
    I use Oracle Forms Builder 10 gr 2 / I have the following problem: in a button I trigger when it is pressed. And then I change a few elements prompt text. But my problem is how to return the original prompt text. A kind of refresh or clear?


    Here is a piece of code that modifies the prompt text:
    set_item_property('XXBG_CE_STATEMENT_LINES_NEW.AGENT_NO', PROMPT_TEXT, get_item_property('XXBG_CE_STATEMENT_LINES_NEW.AGENT_NO', prompt_text) || '*');
    Thanks in advance,
    Bahchevanov.

    This is not tested, but it's something like this:

    declare
       v_item  varchar2(200);
    begin
       v_item := get_block_property('block',first_item);
       loop
          exit when v_item = 'block.'||null;
          set_item_property(...);
          v_item := 'block.'||get_item_property(v_item,nextitem );
       end loop;
    end;
    
  • How to return the approver e-mail notification iProcurement in R12?

    Hi all

    How to return the approver e-mail notification iProcurement in R12?

    Symptom: A Summit a requisition to B, need for approval of B

    (1) B lost the e-mail that is sent by A
    (2) need B a new notification sent by A.

    environment: Oracle R12.1.2 | AIX 6.1




    Concerning
    Terry Chen

    I thank you for your answer, you want to reassign B once again?

    Yes.

    Can I use the feature "Rewind"? Can this function sends notification to the user again?

    Don't know if it would work for notifications of iProcurement, then please try first the option to reassign.

    Thank you
    Hussein

  • How to make the handles visible direct selection on the pasteboard?

    When I go to for transformation/resize images within frames using direct Selection, I don't see the handles of the image because they are white against a white cardboard.  I use InDesign CS5 (ver 7.0.4) on a Mac. I've been using InDesign for a few years and never noticed that it was a problem; all of a sudden, the handles seem invisble. I don't remember what the color scheme was before. (Maybe I'll lose my mind). The colors did not alter an update? There is an option in the preferences to choose the color of the pasteboard, but this does not seem to have any effect. In the meantime, I can't find the handles to resize/convert images. I can enter a percentage to scale, but it is sometimes useful. How to make the handles visible direct selection on the pasteboard?

    If you're talking about the color of a path and its handles, which is dependent on the color of the layer selection. Go to the layers panel. Double-click the currently selected schema and change the selection to something darker color.

  • How to get the value of a selected character unicode?

    Hi all

    How to get the value of a selected character unicode?

    The content property of a 'Character' InDesign object is a simple Unicode string. For access to the various characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

    Therefore, the value of a selected character unicode is

    App.Selection [0]. Characters [0].contents.charCodeAt (0)

  • How to disable the line for lines of saved selection.

    Hi Experts,

    JDEV 12.1.2.0

    I have a popup and below, I have a table. Initially, all lines are in createInsert mode.  How can I disable the selection of rows to only save of the lines. And activate the lines which are not saved.

    Thanks in advance.

    Roy

    As Cvele_new_account already mentioned, your use case is not clear. I guess you want to do something like https://blogs.oracle.com/adf/entry/highlighting_new_rows_in_adf but this is only a guess.

    Timo

  • How to make the lines selectable listfield, when the list has been added to a dialog box

    Hello

    I added a listfield to a dialog box. Now I want that when I click on a line any of this list field, I should get a menu (i.e. something should be available for me so that I can perform an action on the selected line). But when I click on the line, nothing happens.

    Help, please

    Create your own screen, its less than the actual display dimensions to make it look like a pop-up screen. When a line is selected/clicked, call makeMenu.

  • How to change the lines in the interactive report?

    I want to change the lines in interactive reports before and after filtration. I added "edit_link in SQL and the column in the region but settings I don't know how to load data into the page with form created for editing data in line.

    There are examples in the sample applications, but the steps are.

    Create a new page which, with the right ID available, select the database details and allow you to edit the details and save them in return. A positive result of the Save (or cancel) arange the page with a branch back to your interactive report.

    On your interactive report, for your chosen link column, set it to branch to the page you created above and set the item of page ID on the page to the value of the ID in your crrent folder.  Selection lists will help here.

    Now, by clicking on your link edit show open the new page and select the details of the database preparation n for any update, you choose to make and record.

    Stewart

  • APEX 5.0 Interactive report (nopadding, how to set the line height)?

    APEX 5.0.

    Theme: 26. Productivity applications

    Interactive report region

    Where and how can I global set Dimensions height of the line and policies, etc., lines in interactive report?
    I use standard interactive report.

    Thank you

    user555867 wrote:

    Please help me in detail.

    The best way to get detailed help is to create an example on apex.oracle.com and share credentials of developer comments in the workspace here.

    I have:

    1 created a (= external CSS style sheet) file with the name 'ir_css_padding.css' local on PC (C:\tmp).

    2 added "Shared components"-> 'Static Application files'-> 'Download the file statistics Appl.': 'c:\tmp\ir_css_padding.css '.

    3. under "attributes of User Interface:

    (General properties)

    The value 'Statistics file prefix': ' #APP_IMAGES #ir_css_padding.css.

    'Media Type' value: text/css

    Why have you changed these settings? They are not relevant to the addition of static CSS files in the repository database. Read the help on line for these properties:

    Static file prefix

    Determines the virtual path of the Web server uses to point to static files when you use the #APP_IMAGES substitution string #.

    Do not specify what to do refers to files that are stored with your application definition in the database.

    For performance reasons, you can also store your application files on your Web server. Use a valid URL to refer to them.

    Media type

    Enter the Internet media type. An Internet media type is identifier into two parts for the formats of files on the Internet. A media type is composed of at least two parts: a type and a subtype and one or more optional parameters. This type of media used in the HTTP Content-Type header when the page is rendered.

    If both the values of page-level and the level of the application for the media Type are NULL, text/html is used.

    Two of these parameters must be null in your current environment.

    (The User Interface definition)

    "CSS File URL' value: 'text/css/ir_css_padding.css '.

    This parameter must use the static text of APP_IMAGES substitution string:

    &APP_IMAGES.ir_css_padding.css

    After that, I can't jerome in application. (See the only CSS text in the browser)

    --> WHAT IS THE PROBLEM?

    APEX is serving pages using the type of text/css media according to the incorrect media Type parameter described above. Remove and the app will return to normal.

    4. WHERE and HOW VALUE / reference the CSS file?

    I need this change for all interactive reports in my application, self think I can change my model that I use: 'interactive report Region '.

    Interactive report region isn't just a region container designed for use with interactive reports. It does not control the appearance of the interactive reports somehow. Not there at - it a report model for interactive reports. Their appearance can be changed using CSS.

  • How to remove the output of a SELECT on the page out of the Script

    Hello

    I'm running a particular piece of SQL with bind variables. The goal is to get the execution
    plan using DBMX_XPLAN. DISPLAY_CURSOR.

    To get the variables and bind the values of the variables in make them work, I found that I have to select
    instructions in the worksheet, and then press F5.

    It's working very well, but the question I have, is that this SQL data returns more 60 000 rows.

    I don't want to see the lines, and in addition there are limits on the number of rows can be displayed
    in SQL developer.

    Is there a way I can delete the results of the SQL query that appears in the output window of the Script?

    I tried:

    termout off Set
    Set autotrace traceonly
    set pagesize 0

    But nothing makes no difference. Surely I can stop behaving this way? Any suggestions?

    I use SQL Developer 3.2.09

    Thank you!

    Paul Stuart

    Hi Paul,.

    I don't believe it. Same queue the result of a query (whether inline or embedded via @.sql) does not output to the spreadsheet results pane. And internally, to explain the Plan and auto-trace, Developer SQL uses dbms_xplan.display instead of display_cursor.

    Probably your best bet is to reduce total output via Tools | Preferences | Database | Worksheet | Max lines to print in a script. That the setting does not affect the SQL sent to the database, it just limits how the SQL Developer result set that bothers to display when you run Script. Any information you get from display_cursor should be affected. Of course, the worksheet sends many other SQL to the database, that you don't see, so based on the default behavior of 'Look the last cursor' will not work. I assume that you have already taken into account for this.

    Kind regards
    Gary
    SQL development team

Maybe you are looking for

  • Thunderbird for android it exists

    I tried to install no icon and no end message

  • HP Officejet Pro 8600 Plus Scan quality issue

    Hello I just set up my HP Officejet Pro 8600 Plus, and everything seems to work properly.  I am really disappointed by the quality of the images so, so I thought I'd see if anyone has experienced the same problem? The scanned images are very dynamic,

  • LOGO! PLC driver based on LabVIEW

    1024 x 768 Normal 0 21 false false false EC ARE X-NONE X-NONE MicrosoftInternetExplorer4 / * Style Definitions * / table. MsoNormalTable {mso-style-name: "Tabla normal" "; mso-knew-rowband-size: 0; mso-knew-colband-size: 0; mso-style - noshow:yes; ms

  • Printing with the file name on the bottom of the

    How can I make prints all outs of any file display the name and location of the file on the lower edge of the paper?

  • Two monitor attached by DVI, only working

    Hi, I recently installed a NVIDIA 8400 GS video card and attached a second monitor that I use the card DVI port. I am running Win 7. Now the monitor which was attached to the motherboard DVI port does not work. I suspect that the disabled card video