[thelist] MySQL - selecting records that are NOT in a date range...

Tris beertastic at gmail.com
Tue Nov 20 04:15:07 CST 2007

Iv'e got a table of activitives on a site.
I want to pull all user Ids of users who have NOT been logged in sept 07.

So I need to have my daterange (unix timestamp)
SELECT `UserId` FROM `activities` WHERE `Timestamp` > '1191196799' AND
`Timestamp` < '1188604800' GROUP BY `UserId`

But how can I say to MySQL: get me all users who DON'T have entries in
this range...
i can find 101 tutorials on how to get dates within a range, but not
the other way around...


Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others
to laugh at him.`
Thomas Szasz

More information about the thelist mailing list