Announcement

Collapse
No announcement yet.

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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


    • #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


      • #4
        thank you.

        Comment

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