What is the SQL Query command for "Has not logged on for x days"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GearTripper
    Senior Member
    • Aug 2004
    • 440

    What is the SQL Query command for "Has not logged on for x days"?

    Looking to do the following; what is the correct command for the bolded text?


    UPDATE user
    SET usergroupid = xx
    WHERE usergroupid = xx
    AND Has not logged on for x days = x
  • Jose Amaral Rego
    Senior Member
    • Feb 2005
    • 11058
    • 1.1.x

    #2
    It can be lastvisit and or lastactivity, it just upto you on how exact you want it.

    Just testing time display with query below.
    Code:
    SELECT username, email, usergroupid, FROM_UNIXTIME( lastvisit, '%D %M %x %h:%i:%s' ) AS lastvisit, posts
    FROM user

    Comment

    • Jake Bunce
      Senior Member
      • Dec 2000
      • 46598
      • 3.6.x

      #3
      AND lastactivity < UNIX_TIMESTAMP('yyyy-mm-dd 00:00:00')

      Set an appropriate date. This expression will be true for anyone who hasn't been active since that date.

      Comment

      • GearTripper
        Senior Member
        • Aug 2004
        • 440

        #4
        thank you.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...