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
Solved

MySQL Date Addition

Posted on 2006-11-19
6
371 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 143

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 143

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 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17975246
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 143

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
setup wamp server for first time 2 83
Sql query on a varchar that is numeric. 8 44
MySQL  on Tomcat 8 68
Very Large data in MYSQL 7 73
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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