How to select each next user activity

I have a data as below

Select 1 as userid, 'I' Act, double sysdate
Union of all the
Select 1 as userid, 'I' Act, sysdate + 1 double
Union of all the
Select 1 as userid, 'C' law, sysdate + 2 double
Union of all the
Select 1 as user name, 'C' law, sysdate + 3 double
Union of all the
Select 1 as userid, 'I' Act, sysdate + 4 double
Union of all the
Select 1 as userid, 'C' law, sysdate + 5 double
Union of all the
Select 1 as user name, 'C' law, sysdate + 6 double
Union of all the
Select 1 as userid, 'C' law, sysdate + 7 double
Union of all the
Select 2 as username, 'C' law, sysdate + 1 double
Union of all the
Select 2 like userid, 'C' law, sysdate + 2 double
Union of all the
Select 2 as username, 'C' law, sysdate + 3 double

O/P

Law on the user Date
--------------------------------
1. I HAVE 24-SEVEN.-10
1. I HAVE 25-SEVEN.-10
C 1 26-SEVEN.-10
1 C 27-SEVEN.-10
1. I HAVE 28-SEVEN.-10
1 C 29-SEPT.-10
1 C 30-SEVEN.-10
1 C 1 OCTOBER 10
2 C 25-SEVEN.-10
2 C 26-SEVEN.-10
2 C 27-SEVEN.-10

Now, I want to select all the activity of C of a user who was held following immediate from C
that is on top of the data I need to select


Law on the user Date
--------------------------------
1 C 27-SEVEN.-10
1 C 30-SEVEN.-10
2 C 25-SEVEN.-10
2 C 26-SEVEN.-10
2 C 27-SEVEN.-10

Can someone help me please?

OK, then you can use LAG analytical function to retrieve the previous law for each line within groups of USERID:

WITH t AS (
 select 1 as userid, 'I' act, sysdate dt from dual union all
 select 1 as userid, 'I' act, sysdate+1 from dual union all
 select 1 as userid, 'C' act, sysdate+2 from dual union all
 select 1 as userid, 'C' act, sysdate+3 from dual union all
 select 1 as userid, 'I' act, sysdate+4 from dual union all
 select 1 as userid, 'C' act, sysdate+5 from dual union all
 select 1 as userid, 'C' act, sysdate+6 from dual union all
 select 1 as userid, 'C' act, sysdate+7 from dual union all
 select 2 as userid, 'C' act, sysdate+1 from dual union all
 select 2 as userid, 'C' act, sysdate+2 from dual union all
 select 2 as userid, 'C' act, sysdate+3 from dual
)
SELECT userid, act, dt
FROM (
 SELECT t.*,
        lag(act) over(partition by userid order by dt) prev_act
 FROM t
)
WHERE act = 'C'
AND prev_act = act
;

Tags: Database

Similar Questions

  • How to select the next item in a table view?

    Hey,.
    I want to select the next item, but I have no idea about it? have you any suggestions?
    for example:
    the second element is currently selected, I need to select the third in my code, how can I implement this feature?
    private IntegerProperty index = new SimpleIntegerProperty();
    
        public final double getIndex() {
            return index.get();
        }
    
        public final void setIndex(Integer value) {
            index.set(value);
        }
    
        public IntegerProperty indexProperty() {
            return index;
        }
    

    Get the selected item:

    table.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
    
                @Override
                public void changed(ObservableValue observable, Object oldvalue, Object newValue) {
                    Person selectedPerson = (Person) newValue;
                    setIndex(data.indexOf(newValue));
    
                }
            });
    

    Select the following index:

    table.getSelectionModel().select(index.get() +1  );
    
  • How to select each row in a table where there is no user input?

    My order is: DUMMY_BLK. It has field: NWTFR.

    My basic block is: T_UNLDLD_BLK.
    In the palette of the property, where clause is: ULD_RPTNO =: DUMMY_BLK. NWTFR

    When the user presses the search button, it gets results according the unindexed in report. My trigger when-pressed key contains the following code:
    go_block ('T_UNLDLD_BLK');
    execute_query;


    If the NWTFR is null, I should get displays all records in the T_UNLDLD table.

    How can I do that, I need to add to the place where clause please?

    Thank you.

    Hai,

    change the where nearby

    ULD_RPTNO LIKE NVL(:DUMMY_BLK.RPTNO, '%');
    

    Kind regards

    Manu.

    If this answer is useful or appropriate, please mark. Thank you.

  • How to select each lower word end of line

    Dear friends,

    I need your help.

    @Just: I need to select one word to each line and each last paragraph below.

    I have attached example screenshot below:

    Untitled.png

    Thanks in advance

    Try this:

    try {
        // gets the lines from the first paragraph in the first story of the active doc.
        var lines = app.activeDocument.stories.firstItem().paragraphs.firstItem().lines;
    } catch(e)
    {
        alert("This script needs an InDesign document to be open whose first story is not empty");
        exit();
    }
    
    var lineCount = lines.length;
    var shortestWord = null;
    for (var x = 0;x < lineCount;++x)
    {
        lastWord = lines[x].words.lastItem();
        if (shortestWord == null || lastWord.length < shortestWord.length)
        {
            shortestWord = lastWord;
        }
    }
    
    shortestWord.select();
    
  • How does the licensing of user/activation/cloud system affect me?

    With the old system to buy and use, upgrade when you can afford , the license has been clear that you could install 2 copies of the software on different machines, offering only 1 has been used both.

    How does the cloud with activation and users now?

    I am a 1-man-band design agency and would like to be able to work on my main desktop machine, while in office, but also on my laptop when out and about. Can elaborate you on how the cloud will work in my scenario? I hope that "Insert here a deity" it because otherwise I just put myself out of mobile business! Laughing out loud

    Also every time a machine dies horribly, it does from time to time, how the cloud will deal with a new installation on a new computer - will I have old TELEPHONE painful activation of a guy trying to figure out why I installed the number of copies 3 or he as magically remember me and my preferences and make something as done steam? See below for users of steam:

    With systems simlilar and steam (for games), you can log into your account and download and use the software on any machine (provide your connection) and any platform (mac, pc, ps3) which is a brilliant choice. You cannot dodge the system either because the minute you "login" elsewhere, the other account is essentially disabled. I could travel in Australia, using my friends Mac and 20 minutes to continue playing a game at home, I was playing in the United Kingdom on a PC. I have no fear of him using the account that I don't tell him how to connect and do not save my details. As soon as I connect to the House once again, his machine is disconnected and disabled even if I left it on. Its simple, but it works brilliantly. It records the cloud or individual preferences preferences too (in case say, its screen is a lower resolution, etc.)

    That's how works the creative cloud - if he shouldn't! IDEA...

    I have a mac and PC at work - how bright would it be to have only 1 subscription on any platform (if only I stick to the 1 user at the right time)

    If the user login is crucial, I could use any machine or platform at any time - cloud of real work, real cross-platform.

    The licensing Creative Cloud membership is more less the same as before, all computers (Windows or Mac).

    If you had a system that crashed, and that you do not clear, what happens when you go to install on a new computer is it would give you an option to 'disable all' (there is a new option). After that, you can reactivate just on two computers, you want it again.

    The software does not support mobile licenses, you can always turn off using the help > "disable" feature. Being able to license on different machines based on a mobile log-in is something that others have suggested as well (good idea), but is not currently supported.

    You can install on your Mac and PC, however, the subscription is not platform specific.

    -Dave

  • How to select view Internet users

    Hello

    I'm deploying a View 3 infrastructure for all users.

    I deploy security servers too, but I don't want all my users to access their desktop via the Internet. I want to dedicate Internet access to a Happy Few.

    I don't see anything on display administrator to filter remote users.

    It is possbile?

    What about assigning a different range of intellectual property to the pool of LAN and blocking 3389 from the server security for this range of IP addresses?   They will not be able to access the pool from the web, but those on the outdoor pool will continue to be able to access it remotely.

    If you have found this device or any other useful post please consider the use of buttons useful/correct to award points

  • How to select and move more than one bookmark at a time? Shift + click selects multiple items that are next to each other in a list, because the element

    How to select and move more than one bookmark at a time?
    Shift + click selects multiple items that are next to each other in a list, because the items open in firefox before that happens.

    Glad it worked for you. Thanks for posting back.

  • How can I remove USER ACTIVE when I go into my PC, please? __

    How can I remove USER ACTIVE on the screen when I'm on

    computer, please?

    sikki14

    Sounds like you might want to take a look at: How to disable the functionality of quick-change to user in Windows Vista

  • How to unlock any countinuesly user in active directory 2003?

    How to unlock any countinuesly user in active directory 2003?

    Hello Amol,

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    TechNet Forum

    http://social.technet.Microsoft.com/forums/en-us/winserverDS/threads

    Hope this information helps.

  • How to extract the selected ESXi host user name and the password in the web client of vSphere?

    Hi all.

    I'm developing a plug-in for the web client to vsphere. I want to communicate with the selected host of ESXi in my Java Service Layer and who needs the host user name and password.

    I don't know how to search the Flex user interface layer.

    ESXi credentials are not stored in the user interface layer, you must use the vSphere SDK Web Service on the coast of java.  See vim.host.ConnectInfo.

  • How to get the list of active users in Essbase 6.5.6

    Hi gurus,

    How to get the list of active users in Essbase version 6.5.6

    I can't find any Esscmd list of active users...

    I used the command LISTLOGINS in ESSCMD, but it did not help me...

    pls suggest me an approach to find the list of active users.

    Thanks in advance...

    Hi guru,.

    When you connect to the application, you will find the security option---> connect you will find active use in the ESSBASE.

    If you need the list of users in the use of ESSBASE that recommends essmsh

    go for the race---> essmsh---> login user server use this tribute

    (1) session view all this;

    If you want to export the active users usebelow congratulate.

    2)

    spool to 'D:\suresh.txt ';

    poster session;

  • How to get zone selected by the user in the Managed bean code

    Hello

    In our project, we use af:inputDateto to get details about the information of Date, time, and time zone.

    < af:inputDate label = "#{bundle." LABEL_1}.
    autoSubmit = 'true '.
    value = "#{pageFlowScope.attributeValuesBean.DateTime} '"
    valueChangeListener = "#{pageFlowScope.resourceCreateEditBean.pageValueChangedListener} '"
    ID = "id3" >
    < af:convertDateTime type = "both" timeStyle = timeZone = "#{"long"pageFlowScope.resourceCreateEditBean.preferredTimeZone}" / > "
    < / af:inputDate >

    the value attribute of date. MinValue is mapped with pageFlowScope.attributeValuesBean.dateTime which is a java.util.Date.

    for specific details, I used following code

    SimpleDateFormat sdf = new SimpleDateFormat ("dd MMM yyyy hh: mm: z");
    String s = sdf.format (date);

    which returns the date in the format "dd MMM yyyy hh: mm: z". However, this API will always return timezone of server, and in accordance with our project we need the details of the user selected time zone.

    is it possible to get the time zone selected by the user on the dateTime picker?

    Ajay,

    When LOV TimeZone is active on the date picker, it is not possible to retrieve the time zone selected by the user. There is an enhancement request filed for this feature.

    Since this is a known issue, there is a way to accomplish what you want:

    (1) the date picker does the conversion of the local time zone to UTC (GMT) time and provides a Java Date object.
    In order to bypass this conversion, you can use one of the techniques is:

    It's basically asking for the date picker to convert time UTC time UTC (no conversion) :-)

    (2) separate the zone LOV the date picker. You can use the function af:getCommonTimeZoneSelectItems() for this purpose.

  • How to execute each block in a canvas close while that select the tab?

    Hi all

    How to execute each block in a close canvas by selecting a tab? I mean when I select a specific tab in a canvas tab that records should run. How can I configure this?



    Arif

    Arif,

    Make sure that the correct block name is used in the GO_BLOCK statement. As directed by your post, you try to navigate to USERDELETION block when the tab page is USER_CREATION_LIST. Modify the code to

       IF GET_CANVAS_PROPERTY('CAN_SUPERVISOR', TOPMOST_TAB_PAGE) = 'USER_CREATION_LIST' THEN
          go_block('USERCREATION');
          execute_query;
       ELSIF GET_CANVAS_PROPERTY('CAN_SUPERVISOR', TOPMOST_TAB_PAGE) = 'USER_DELETION_LIST' THEN
          go_block('USERDELETION');
          execute_query;
       END IF;
    

    Kind regards

    Manu.

  • How to select the values for each check box in a group of records

    Hello

    I have a requirement in form 10g. In this form there are 10 records are display each record has a checkbox is there if I click on the check box save number one and number three and make some changes in the text field (field adjustment is the number data type) and then finally, I want to see the total a total amount called field.

    In this, my question is how to select specific to a group of records records? and finally these selected records are inserted in a table.
    Because I am not able to read these records at a time.
    Is there any table to define a record group to fetch each of them individually for example Rec [1] Rec [2]... like this if yes please suggest me the steps how to do this.

    Thanks in advance
    Prasanna

    Published by: user10315107 on December 17, 2008 23:44

    OK, so you want to shoe the total amount in the form itself (I guess that somewhere under the dashboard lines?).

    You can do this easily using formulat elements:

    1 create a new item in your block where the field amount is places, set "section of the database" on the 'No', 'calculation mode' to the 'formula' and the 'formula' himself to something like:

    CASE WHEN :BLOCK.CHECKBOXITEM=CHECKVALUE THEN :BLOCK.AMOUNT+:BLOCK.ADJUSTMENT ELSE 0 END;
    

    This formula returns 0 if the checkboxitem is not checked, otherwise the sum of amount and adjustment (of course you can adjust the names of elements and the value for 'Checked')
    2. place the element in the layout, if you wish.
    3. set the property "Query all Records" to "true" for your block elements, this is necessary for the calculation to work
    3 create a control block to keep summary article in a, "Single Document" set to 'True '.
    4. place a new element in this control block, set 'Calcuation mode' to 'Summary', 'Summary block' to your block elements, 'Summary point' in newly created formula section in the block elements
    and function of synthesis for the "sum".
    5. place the element in the layout

    She's.

  • How to select one of the VMRC and WebMKS of vRealize of automation for the end user

    As you know, there are two Protocol to use the remote console to the configured virtual machine of vRealize Automation. I know how to select one of the VMRC and WebMKS on vCenter via Web Client, but I'm not sure whether vRealize Automation can select one of the VMRC and WebMKS. Is there anyone who knows about it?

    You can set in the law.

    Grant

Maybe you are looking for

  • Encoding error on some MP3s in Firefox?

    The url below plays in all ie/chrome/safari but not firefox on windows. It has been tested and plays in Firefox on mac. Please notify. http://www.jwpepper.com/audio/10514376-2.mp3

  • When I click on download it used oprn - why

    When I try to open a downloaded item, I click it and nothing happens.This just started to happen.

  • Equium A60-173: need product Recovery DVD-Rom

    Hey guys, I was wondering where I can buy a product recovery dvd - rom for my laptop and if there is an online shop can you please provide a url? Thanks in advance.

  • I received a scam message.

    Original title: text message... Is - this legitimate or a scam? On Tue Jan 29 20:30 (time British) I received a text message from phone number * asking address ID, password, e-mail address, phone number. Is - this legitimate or a scam?

  • Incomplete errno ANSI help

    Salvation OR,. I just found out that the 'errno' help text is incomplete; It reads: functions for files IO the ANSI C and e/s low level functions define the variable global errno to indicate the specific error conditions... However, errno can be also