gpt4 book ai didi

mysql - SQL查询将前面两个数字从 "2048"改为 "1948"

转载 作者:行者123 更新时间:2023-11-29 05:54:18 27 4
gpt4 key购买 nike

我在数据库 “2048-05-21”

中有一个看起来像这样的日期

我只想得到年份,在这一年我只想得到两个后面的数字并将两个前面的数字更改为19

example:

data : 2048-05-21

1st result : 2048

2nd result : 48

3rd result : 1948

4th result: 1948-05-21

SQL可以吗?

最佳答案

从 your_table 中选择年份(your_column)-100够了吗?我假设您的“日期”的列类型为日期或日期时间。否则你必须使用子字符串(https://www.w3schools.com/sql/func_mysql_substring.asp)

关于mysql - SQL查询将前面两个数字从 "2048"改为 "1948",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51149496/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com