日期:2014-05-18 浏览次数:20629 次
select case when Platform='C' then 'CS-'+Description when Platform='W' then 'Web-'+Description end from tb
------解决方案--------------------
declare @t table (ID int,Description varchar(3),Platform varchar(1)) insert into @t select 1,'aaa','C' union all select 2,'bbb','W' union all select 3,'ccc','C' union all select 4,'ddd','W' union all select 5,'eee','W' select ID,C1+Description as Description from @t a left join (select 'CS-' AS C1 UNION SELECT 'WEB-') b on a.Platform=left(b.C1,1) /* ID Description ----------- ----------- 1 CS-aaa 2 WEB-bbb 3 CS-ccc 4 WEB-ddd 5 WEB-eee */