Results 1 to 3 of 3

Thread: query for this

  1. #1
    Join Date
    Aug 2007
    Posts
    21

    Unanswered: query for this

    Hi ,

    i am trying to write a query but not reaching to the conclusion part. here is the req,,

    i want all the distinct users who logged in 6 months ago and if a user who logged in 6 month before and again he looged in after 6 months( means if a user martin logs in 6 months ago and again logs in some time back may be 1 month back) then the user should not be selected as i want to delete those users who only looged in 6 months ago and not after that.

    kindly help me in doing that.here is part of my query.

    select DISTINCT username from arrfsysauditlog where (datelogged < CURRENT_TIMESTAMP - 180);

    Thanks in advance..

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You could do:
    Code:
    select username 
    from arrfsysauditlog 
    group by username
    having max(datelogged) < CURRENT_TIMESTAMP - 180;

  3. #3
    Join Date
    Aug 2007
    Posts
    21
    Thnak You Andrew.

Posting Permissions

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