Change a date field to the last day of the previous month in SQL -


i have date field in database need change last day of previous month. currently, dates in field dated first of month. know can using case statement, however, know there has easier way of doing this.

this date time field if makes difference.

any assistance appreciated.

in sql server can this:

update mytable  set mydatefield = dateadd(day,-1,mydatefield); 

in oracle should be:

update mytable  set mydatefield = mydatefield - 1; 

every major database should have pretty similar


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -