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
Post a Comment