发布网友 发布时间:2022-04-22 08:00
共2个回答
热心网友 时间:2024-01-06 20:28
set @i =0;
create table 新表
AS
select @i:=@i+1 as NO,NO1,NO2,NO3,MYA1 as MM
from(
select NO1,NO2,'MYA1 ' as NO3,MYA1 from 表
union all
select NO1,NO2,'MYA2 ',MYA2 from 表
union all
select NO1,NO2,'MYA3 ',MYA3 from 表
union all
select NO1,NO2,'MYA4 ',MYA4 from 表
union all
select NO1,NO2,'MYA5 ',MYA5 from 表
union all
select NO1,NO2,'MYA6 ',MYA6 from 表
)a order by NO1,NO2;
select * from 新表;
热心网友 时间:2024-01-06 20:29
set @i =0;
create table 新表
AS
select @i:=@i+1 as NO,NO1,NO2,NO3,MYA1 as MM
from(
select NO1,NO2,'MYA1 ' as NO3,MYA1 from 表
union all
select NO1,NO2,'MYA2 ',MYA2 from 表
union all
select NO1,NO2,'MYA3 ',MYA3 from 表
union all
select NO1,NO2,'MYA4 ',MYA4 from 表
union all
select NO1,NO2,'MYA5 ',MYA5 from 表
union all
select NO1,NO2,'MYA6 ',MYA6 from 表
)a order by NO1,NO2;