0

Table name: tasklist

|start_time                |end_time                  |task_duration  |
 __________________________ __________________________ _______________
|2001-01-01 17:24:50.000000|2014-02-04 10:04:10.000000|00:14:53.000000|
|2013-08-31 10:53:09.000000|2013-09-19 11:16:54.000000|00:21:19.000000|
|2013-08-31 18:30:28.000000|2013-10-07 18:43:55.000000|00:13:17.000000|

I have to change date part of start_time to end_time columns retaining the time values as I need it for task_duration column. I used this query to get this

SELECT * FROM `tasklist` WHERE (DATEDIFF(`end_time`,`start_time`)> 1)
2
  • The task duration values are wrong in this, but difference of end_time and start_time will be in task_duration coloumns
    – GhostCoder
    Feb 12, 2014 at 7:50
  • I have to put the same date as that in end_time in start_time for over 2000 rows
    – GhostCoder
    Feb 12, 2014 at 7:57

2 Answers 2

2
UPDATE YourTable
SET YourColumn = DATEADD(MONTH,1,YourColumn) 
WHERE YourColumn = '20120410 08:03:00'
0

You can find the complete reference here. For example, lets say that you want to add 30 days to the current starttime data. You can achieve the same using the following syntax:

UPDATE tasklist SET starttime = DATE_ADD(starttime, INTERVAL 30 DAY);

Hope this helps!

The link provided at the top of this answer contains plenty examples which can help you understand the operations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.