Solved

Mysql Problem selecting timestamp modification in last 24 hours

Posted on 2009-04-05
1
302 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

821 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