Solved

Mysql Problem selecting timestamp modification in last 24 hours

Posted on 2009-04-05
1
304 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

626 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