Solved

Mysql Problem selecting timestamp modification in last 24 hours

Posted on 2009-04-05
1
299 Views
Last Modified: 2013-12-12
Hi Folks,
I have a problem with this query - all I want to do is to get the rows from a table - in this case property - that have been modified in the last 24 hours.
The query runs and looks at the prop_timestamp field, which is an auto updating timestamp field whic updated every time a record is edited BUT it just seems to ignore the timestamp comparison and just returns all rows with a status of 1 ???
I look at it an I reckon it should work but I am going round in circles
SELECT * FROM property p

LEFT JOIN property_branches pb ON pb.branch_id = p.branch_id

LEFT JOIN property_price_prefix ppp ON ppp.prefix_id = p.prefix_id

WHERE p.prop_timestamp > UNIX_TIMESTAMP(NOW()) - 86400 

AND prop_status = '1'

Open in new window

0
Comment
Question by:AlltekTF
1 Comment
 

Accepted Solution

by:
AlltekTF earned 0 total points
ID: 24075103
Ahh - solved it:

Just changed the sql to:

WHERE UNIX_TIMESTAMP(p.prop_timestamp) > UNIX_TIMESTAMP(NOW()) - 86400

sit compared unix timestamps as similar data types - totally missed it before
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now