SQL: Conditional Update

Attached is a screenshot of a database table called FRACK.

I'm looking for help creating a SQL update statement which would compare timestamps in columns RACKED and CHILLROOMSCAN.  If the CHILLROOMSCAN is an earlier date than the RACKED date, I would like to increment the CHILLROOMSCAN value by 1 day, leaving the hour/min/sec AM/PM details unchanged.  

If the CHILLROOMSCAN value is the same date or later than the RACKED value, then no change should take place.

Can someone help?
frack.jpg
mrherndonAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
in ms sql server, it would by DAY and not DD:
update frack set chillroomscan = dateadd(day,1,chillroomscan)
where chillroomscan < racked 

Open in new window

0
 
awking00Commented:
update frack set chillroomscan = dateadd(dd,1,chillroomscan)
where chillroomscan < racked
0
 
mrherndonAuthor Commented:
I see where you're going, but the script error returns column not found:  dd.  Any suggestions?
0
 
SharathData EngineerCommented:
dd is not a column and it is to increment by day. Are you working in MS SQL or MYSQL?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.