sql server 怎么根据年月字段得到上个月字段。比如:
select
month ,
last_month
from A
其中month类型是‘202005’
怎么把last_month写成'202004'
select month, convert(varchar(6),dateadd(month,-1,month+'01'),112) as lastmonth from ...
https://blog.csdn.net/qq_39585172/article/details/83275744
select month,convert(int,month)-1 as last_month from A