Solved

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

Posted on 2009-07-08
4
417 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
  • 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:
yodercm earned 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
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 …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

22 Experts available now in Live!

Get 1:1 Help Now