John John - 10 months ago 34
SQL Question

Update the date in the database with +1 month

I have a date column in my users what I want to update with a SQL query

With the SQL query I want to add 1 month to date column in my database.

I now have:

UPDATE users SET date=(+ 1 month)

When I run this query it is not working. So my question is, how can I make this working?


You never told us the database you are using, so here are several answers:


UPDATE users
SET date = DATE_ADD(date, INTERVAL 1 month )

SQL Server:

UPDATE users
SET date = DATEADD(MONTH, 1, date)


UPDATE users
SET date = ADD_MONTHS(date, 1)