Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    46

    Unanswered: How to get the Previous Log on date

    Hi Experts,

    I am working in Oracle 9i. I have to fetch the previous logon date from the table where it contains all the logged dates of the users.

    1. When a user logs in say on 24.08.2006 and that user's last login date was 21.08.2006.
    In the table there is only one date column created_dt alone.

    How do I take last login date of that user from that table where his max(created_dt) is 24.08.2006.

    2. Also f I login as a user with one assigned role for 4 times in a day, the logins are coming as 1 for that role whereas if I login with a different role, then I am getting that login. I need to get all the logins from the table irrespective of the roles.

    Pl. help me on this.

    Thanks

  2. #2
    Join Date
    Mar 2004
    Location
    Warsaw / Poland
    Posts
    73
    Do You mean sth like that:

    SQL> create table dates(created_dt date);

    Table created.

    SQL> insert into dates select sysdate + level from dual connect by level <= 5;

    5 rows created.

    SQL> select * from dates;

    CREATED_D
    ---------
    25-AUG-06
    26-AUG-06
    27-AUG-06
    28-AUG-06
    29-AUG-06

    SQL> select created_dt from (select created_dt, rownum rn from (select * from dates order by 1 desc) where rownum <= 2) w
    here rn = 2;

    CREATED_D
    ---------
    28-AUG-06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •