Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Red face Unanswered: NOT BETWEEN with UNIXTIME field?

    HI, I have a table where user logins are registered

    Table is called g2_UserinfoMap and it looks like this:

    g_id | g_userId | g_userName | g_ipAddress | g_timeStamp | g_action

    Records in table are added after each user login to the site:


    10 | 100 | user2 | 86.4.44.7 | 1256330245 | Login
    10 | 100 | user1 | 86.5.44.8 | 1256330309 | Login
    10 | 100 | user2 | 86.4.44.7 | 1256330317 | Login
    10 | 100 | user2 | 86.4.44.7 | 1256331833 | Login
    10 | 100 | mano3 | 86.55.2.45 | 1256331859 | Login
    10 | 100 | user99 | 86.100.10.10 | 1256331864 | Login
    I'm trying to make a a select query to show users that were not logged in the last 3 months to the site so I could delete them from site management interface.

    I tried this SQL:
    Code:
    SELECT *
    FROM g2_UserinfoMap
    WHERE g_timeStamp <= UNIX_TIMESTAMP( '2010-02-01 00:00:00' ) && g_userName != 'admin' && g_action = 'Login'
    This gives me users that are not admin, but it lists all users.

    I think I need something like NOT BETWEEN but how to do it with Unixtime (g_timeStamp) field is in unixtime.

    I tried to make like this but get an error obviously:

    Code:
    SELECT DISTINCT *
    FROM g2_UserinfoMap
    WHERE g_timeStamp NOT BETWEEN UNIX_TIMESTAMP( '2010-02-01 00:00:00' && '2010-01-01 00:00:00')

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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