| |

VerySource

 Forgot password?
 Register
Search
View: 800|Reply: 3

Find a SQL statement, please help!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-19 17:30:02
| Show all posts |Read mode
I need to modify a column of time type data in the table. For example, there is a category in the table that is the date of birth, and all those in the table born in 1982 are changed to 1981. Dateadd can be used in Sql Server, but this function is not available in MySql. Hope you all help. Thank you!
Reply

Use magic Report

0

Threads

24

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-7-8 17:00:01
| Show all posts
Try
mysql> select DATE_ADD('1998-01-30', Interval 1 YEAR);
Reply

Use magic Report

3

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-9 20:00:01
| Show all posts
Use UPDATE table name SET column name = new value WHERE condition not work, I am also a rookie, don't laugh
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-24 08:30:01
| Show all posts
update tablename set Date of Birth = Date_ADD(Date of Birth, INTERVAL -1 YEAR) where Year(Date of Birth) = 1982
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list