Skip to content

Instantly share code, notes, and snippets.

@oleander
Created October 5, 2011 20:49
Show Gist options
  • Save oleander/1265662 to your computer and use it in GitHub Desktop.
Save oleander/1265662 to your computer and use it in GitHub Desktop.
SELECT `users`.* FROM `users`
LEFT JOIN `searches` ON `searches`.`user_id` = `users`.`id`
WHERE (searches.id IS NULL OR searches.updated_at < DATE_SUB(NOW(), INTERVAL 1 MONTH))
ORDER BY users.created_at DESC LIMIT 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment