sql语句中insert into 表中 select多个值后插入数据

来源:互联网 发布:最近破获网络涉枪案件 编辑:程序博客网 时间:2024/05/29 05:56

insert into A (Date,FailCount,FailFirstCount,FailSecondCount,FailThirdCount,RecoveryCount)
select '2014-01-01 00:00:00'
,(select count(*) from [201311] where byAreaName =1)
,(select count(*) from [201311] where byAreaName =1 and FailLevel =1)
,(select count(*) from [201311] where byAreaName =1 and FailLevel =2)
,(select count(*) from [201311] where byAreaName =1 and FailLevel =3)
,(select count(*) from [201311] where byAreaName =1 and  IsRecovery=1)

 

select的多个值分别insert into A表中分别对应各个值

0 0
原创粉丝点击