Swadesh
Swadesh

Reputation: 651

1 day older records from mysql

I store date as integer in my table

Now i wish to get all those records which are 1 day older

I use the following code. But it does not work

SELECT * from points where point_date < now() - interval 1 day

Upvotes: 1

Views: 71

Answers (2)

Rahul
Rahul

Reputation: 77856

Try using FROM_UNIXTIME() function and see how it works.

SELECT * from points where FROM_UNIXTIME(point_date) < (now() - interval 1 day) 

Upvotes: 1

Jigar Joshi
Jigar Joshi

Reputation: 240860

SELECT * from points where point_date < DATE_SUB(now() ,INTERVAL 1 DAY) 

Upvotes: 4

Related Questions