select * into #tab from 表名 where 列名 not like '%优%' insert into #tab select * from 表名 where 列名 not like '%良%' union all select * from 表名 where 列名 not like '%中%' union all select * from 表名 where 列名 not like '%差%' union all select * from 表名 where 列名 not like '%次%' update #tab set 列名 = 0
例如,如果字段中没有良,就union
select '良','0'
这样!谢谢!
into #tab
from 表名
where 列名 not like '%优%' insert into #tab
select *
from 表名
where 列名 not like '%良%'
union all
select *
from 表名
where 列名 not like '%中%'
union all
select *
from 表名
where 列名 not like '%差%'
union all
select *
from 表名
where 列名 not like '%次%'
update #tab
set 列名 = 0
1 良中差id name
1 0 良中差