Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Mysql Problem selecting timestamp modification in last 24 hours

Posted on 2009-04-05
1
Medium Priority
?
307 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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.
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 dynamically set the form action using jQuery.
Suggested Courses

972 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