日期:2014-05-19  浏览次数:20388 次

各位高手,我如何取到查出的数据的值并把它取出来!
在数据库里我如何取出刚查询出的字段下的值,并作判断,如何值中没有“优良中差次”中的任何一个字,我就用union创建一个不存在的值设置为0

------解决方案--------------------
什么意思,是字段中不包含“优良中差次”就显示0吗?
举个例子
------解决方案--------------------
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

------解决方案--------------------
我认为LZ的意思是这样

id name
1 良中差

id name
1 0 良中差