在SELECT中,用CASE
例如:
select a.Cname as Tcomname,b.Cname as TGoodname,D.nQuanty,c.cNote, (case when c.iEvaluate='-1' then '差评' when c.iEvaluate='1' then '好评' when c.ievaluate='0' then '一般' end) as ievaluate
from Tcompany a,Tgoods b,Appraise c,orders D
where b.ID=D.nProductID and D.Id=c.order_id and a.Id=b.NsaID
and b.NsaID=@TcomIDTop
select 和 replace
select AdID,replace(replace(cast(AdClassID as varchar(50)) ,'0','头条新闻头部'),'1','头条新闻尾部') as AdClassID,Title,LinkUrl,UpdateTime from Advertisement order by AdID