473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

querry for getting max time within last 24 hours??????

43
hi
i got a situation where i wish to get the latest time from a table within 24 hrs
and to delete the entries which are older than 24 hrs from the current time...
any help??????
Jul 30 '07 #1
2 2263
r035198x
13,262 8TB
hi
i got a situation where i wish to get the latest time from a table within 24 hrs
and to delete the entries which are older than 24 hrs from the current time...
any help??????
What do have so far?
I hope you've read a bit about how to handle dates in MySQL.
Jul 30 '07 #2
mwasif
802 Expert 512MB
You can get the latest time by MAX() function e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT MAX(date_column) FROM table_name
You can use DATE_SUB() to hanlde date like
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM table_name WHERE date_column < DATE_SUB( NOW(), INTERVAL 24 HOUR)
Before executing this query on live data, it is advisable test the query with test data.
Jul 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
1
by: ian douglas | last post by:
Hey all. I know with Perl "there's more than one way to do it", but I'd rather not reinvent the wheel... /usr/share/zoneinfo/Etc/ contains files like GMT-5 or GMT+8 etc which would be really...
8
by: Monty | last post by:
Let's say you provide an online service from 7:00AM to 6:00PM Eastern Time (daylight time in the summer). Is there way of showing these hours of availability on a web page in the user's local...
1
by: Luis Esteban Valencia | last post by:
i've been looking around for a time tracking and billing solution but haven't been able to find anything that will fit my needs. maybe you know of a good one. Criteria: web based (so i can use...
15
by: Cerebral Believer | last post by:
Hi all, I am a newbie to JavaScript and am just trying to get a script going that will write the ful date and time to each webpage as it is viewed. Can anyone point out what mistakes there are...
13
by: angwe23 | last post by:
I've got to fix a system that was basically handed to me. As it currently functions we have four tables as such: 1) Project Hours (includes EmployeeID, ProjectID, Date, Hours) 2) Payrates...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
2
by: dwasbig9 | last post by:
Hi Group (fairly limited knowledge of Access and almost none of Access VBA. Using Access 2003). I need to sum time, I've found through the groups archive an sql extract that led me to this ...
19
by: bowlderyu | last post by:
Hello, all. If a struct contains a character strings, there are two methods to define the struct, one by character array, another by character pointer. E.g, //Program for struct includeing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.