Click here to Skip to main content
15,915,509 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
UPDATE epp_domain set created_on=created_on - interval '2 year' where name='xxx.org';


what is the use of this portion

set created_on=created_on - interval '2 year'
Posted
Updated 25-Aug-14 3:43am
v2
Comments
Vinay Mistry 18-Aug-14 5:00am    
to update created_on = created_on-2 years means created_on will be updated in 2 years back date.

It means that the query will update the created_on by subracting date by 2 years.

For your refrence -

Date arithmetic also can be performed using INTERVAL together with the + or - operator:

date + INTERVAL expr unit
date - INTERVAL expr unit
 
Share this answer
 
Hi,

check this...

...Intervals[^]


SQL
set created_on=created_on - interval '2 year'


above will set created_on date of two years back from existing date in field.


Hope this will help you.


Cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900