Solved

MySQL Date Addition

Posted on 2006-11-19
6
357 Views
Last Modified: 2008-01-09
I'm trying for something like this:

DELETE FROM reservation WHERE reservedtime + INTERVAL '2' HOUR < NOW()

I've seen any number of examples but not a lot seem to work :s

Anyone have the correct syntax please?
0
Comment
Question by:basiclife
  • 4
  • 2
6 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17975243
DELETE FROM reservation WHERE DATE_ADD(reservedtime , INTERVAL 2 HOUR ) < NOW()
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17975245
more efficient:

DELETE FROM reservation WHERE reservedtime < DATE_SUB( NOW(), INTERVAL 2 HOUR )
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17975246
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 5

Author Comment

by:basiclife
ID: 17975277
Thank you. I awas using angelIII's soution before but it wasn't deleting the records intended. I've just realised - The server is in the US, I'm in the Uk. The records were transferred from my machine to the server. The timestamp is about 7 hours out... *sigh*

Even points split coming up. Thanks both.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17975282
>Thanks both.
Glad I could help... looks you didn't realize i posted all 3 comments :-)
0
 
LVL 5

Author Comment

by:basiclife
ID: 17975289
lol. Sorry. long LONG day. I saw you were 1st/3rd.... for some reason didn't see you were 2nd too
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

13 Experts available now in Live!

Get 1:1 Help Now