各位老师:在sql中如何把一个表中的内容,变成另一个表的模式,请给出具体代码!!!

变之前:变之后:
2025-03-24 20:01:24
推荐回答(1个)
回答1:

--照你给的数据应该是把月份作为num,然后名字和年月拼接显示了
select cast(right(id, 2) as int) as num,
       keyword + '(' + cast(id as varchar(10)) + ')' as keyword
  from 表名 order by 1