Select a+(Case status When 0 Then '(已停用)' End) As a From test
create table test(a int,b int,status int) insert into test select 1,1,0 union all select 2,2,1 union all select 3,3,1 Select cast(a as char(1))+(Case status When 0 Then '(已停用)' else '' End) As a From test
注意: 此处如果a/b字段为int,需要使用cast函数来实现类型转换,也可以使用Rtrim实现 Select Rtrim(a)+(Case status When 0 Then '(已停用)' else '' End) As a From test
insert into test
select 1,1,0 union all
select 2,2,1 union all
select 3,3,1
Select cast(a as char(1))+(Case status When 0 Then '(已停用)' else '' End) As a From test
此处如果a/b字段为int,需要使用cast函数来实现类型转换,也可以使用Rtrim实现
Select Rtrim(a)+(Case status When 0 Then '(已停用)' else '' End) As a From test
else '' 这个很关键,否则是不行的