If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > NOT BETWEEN with UNIXTIME field?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-20-10, 14:49
smile_m smile_m is offline
Registered User
 
Join Date: Feb 2010
Posts: 1
Red face 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:

Quote:

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')
Reply With Quote
  #2 (permalink)  
Old 02-21-10, 07:05
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 8,768
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On