Skip to content

Instantly share code, notes, and snippets.

@kakha13
Last active December 28, 2015 23:19
Show Gist options
  • Save kakha13/7577866 to your computer and use it in GitHub Desktop.
Save kakha13/7577866 to your computer and use it in GitHub Desktop.
Select from Table row from user that was recorded more than one day ago.
-- BY Kakha Giorgashvili
-- Select Older than 1 day rows
SELECT
*
FROM
column_name
WHERE
USER = '1234'
AND added_time < DATE_ADD(NOW(), INTERVAL - 1 DAY)
AND added_time <> '0000-00-00 00:00:00'
@kakha13
Copy link
Author

kakha13 commented Nov 21, 2013

Select Older than 1 day rows - SQL query

How it Works?

query is selecting row what is older than one day width code:

added_time < DATE_ADD(NOW(), INTERVAL - 1 DAY)

and this:

added_time <> '0000-00-00 00:00:00'

Web Site: WWW.ANY.GE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment