Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MySQL select a row where datetime (epoch) over 20 minutes old

Posted on 2009-07-08
4
Medium Priority
?
459 Views
Last Modified: 2012-05-07
Hi,
I have a column called datemade, it is stored in this type of format:
1238404018
Epoch?
What i want to do is only selct rows that are over 20 minutes old?

SELECT *
FROM salestable
WHERE datemade +??

Then I'm stuck

Any suggestions please????
0
Comment
Question by:tonypearce
[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
  • 2
4 Comments
 
LVL 5

Expert Comment

by:mallcore
ID: 24805753
SELECT *, from_unixtime(datemane)
FROM salestable

with this you will get time in normal format
0
 
LVL 5

Expert Comment

by:mallcore
ID: 24805774
SELECT *, from_unixtime(datemane)
FROM salestable
WHERE unix_timestamp('yourtime')


better version sorry
0
 
LVL 27

Accepted Solution

by:
Cornelia Yoder earned 2000 total points
ID: 24805908
You can select the unix epoch date directly, or formatted into a standard datetime (from_unixtime(datemade)) .

You can get the 20 minutes from adding a WHERE clause to your query:

SELECT * FROM salestable
WHERE SUBDATE(unix_timestamp(NOW()), INTERVAL 20 MINUTE) > datemade
0
 

Author Closing Comment

by:tonypearce
ID: 31601213
Thanks very much, complete and accurate
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 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