select case company_kind when 1 then '国有' when 2 then '私有' when 3 then '外企' phone_q+'-'+company_phone from A
select case a.company_kind when 1 then N'国有' when 2 then N'私有' when 3 then N'外企' end, rtrim(phone_q)+'-'+rtrim(company_phone) from A,B where 关联条件
忘记End了:(select case company_kind when 1 then '国有' when 2 then '私有' when 3 then '外企' end, phone_q+'-'+company_phone from A
1.select case company_kind when 1 then '国有' else company_kind end as company_kind,* from yourtable
1.select case company_kind when 1 then '国有' else company_kind end as company_kind,* from yourtable
select case company_kind when 1 then '国有' when 2 then '私有' when 3 then '外企' end ,isnull(phone_q,'')+ case when phone_q is null then '' else '-' end+ isnull(company_phone,'') from 表
--或者: select substring(N'国有私有外企',a.company_kind*2-1,2), rtrim(phone_q)+'-'+rtrim(company_phone) from A,B where 关联条件
--或者: select substring(N'国有私有外企',a.company_kind*2-1,2), rtrim(phone_q)+'-'+rtrim(company_phone) from A,B where 关联条件
1. select ase company_kind when '1' then '国有' when '2' then '私有' when '3' then '外企' end from A表 2.select phone_q+'-'+company_phone as phone-number from A表
select company_kind=case when company_kind=1 then '国有' when company_kind=2 then '私有' when company_kind=3 then '外企' end,phone=cast(phone_q as varchar)+'-'+cast(company_phone as varchar) from tb
大家抢啊,呵呵select case A.company_kind when 1 then '国有' when 2 then '私有' when 3 then '外企' End , convert(varchar(5),A.phone_q)+'-'+convert(varchar(10),A.company_phone) as PhoneNum from A,B where --关联条件
1. select case company_kind when '1' then '国有' when '2' then '私有' when '3' then '外企' end from A表 2.select phone_q+'-'+company_phone as phone-number from A表
select case a.company_kind when 1 then '国有' when 2 then '私有' when 3 then '外企' end as company_kind, a.phone_q+'-'+a.company_phone as phone from A表 a, B表 b where ...
感觉这种比较好用,如果万一国有私有外企又添加有得写一堆代码了。 select substring(N'国有私有外企',a.company_kind*2-1,2), rtrim(phone_q)+'-'+rtrim(company_phone) from A,B where 关联条件
不太明白你的意思,给具体一点的 select b.* from a,b where a.id1=b.id2 是这个么? ------------------------------------------------------------------------------------ 还有一点(3)B表中id2与A中id1相等,例如:B表中name值为,q1,q2,q3,对应的id2=100,A表中id1=100,想取出B表中的值怎么半
select case a.company_kind when 1 then N'国有' when 2 then N'私有' when 3 then N'外企' end, rtrim(phone_q)+'-'+rtrim(company_phone) from A,B where 关联条件 这么我看不到星星?
when 2 then '私有'
when 3 then '外企'
phone_q+'-'+company_phone
from A
when 1 then N'国有'
when 2 then N'私有'
when 3 then N'外企'
end,
rtrim(phone_q)+'-'+rtrim(company_phone)
from A,B
where 关联条件
when 2 then '私有'
when 3 then '外企'
end,
phone_q+'-'+company_phone
from A
when 2 then '私有'
when 3 then '外企'
end ,isnull(phone_q,'')+
case when phone_q is null then '' else '-' end+
isnull(company_phone,'')
from 表
select substring(N'国有私有外企',a.company_kind*2-1,2),
rtrim(phone_q)+'-'+rtrim(company_phone)
from A,B
where 关联条件
select substring(N'国有私有外企',a.company_kind*2-1,2),
rtrim(phone_q)+'-'+rtrim(company_phone)
from A,B
where 关联条件
when '2' then '私有'
when '3' then '外企'
end from A表
2.select phone_q+'-'+company_phone as phone-number from A表
from tb
when 2 then '私有'
when 3 then '外企'
End ,
convert(varchar(5),A.phone_q)+'-'+convert(varchar(10),A.company_phone) as PhoneNum
from A,B
where --关联条件
when '2' then '私有'
when '3' then '外企'
end from A表
2.select phone_q+'-'+company_phone as phone-number from A表
case a.company_kind
when 1 then '国有'
when 2 then '私有'
when 3 then '外企'
end as company_kind,
a.phone_q+'-'+a.company_phone as phone
from
A表 a, B表 b
where
...
select substring(N'国有私有外企',a.company_kind*2-1,2),
rtrim(phone_q)+'-'+rtrim(company_phone)
from A,B
where 关联条件
select b.* from a,b where a.id1=b.id2
是这个么?
------------------------------------------------------------------------------------
还有一点(3)B表中id2与A中id1相等,例如:B表中name值为,q1,q2,q3,对应的id2=100,A表中id1=100,想取出B表中的值怎么半
when 1 then N'国有'
when 2 then N'私有'
when 3 then N'外企'
end,
rtrim(phone_q)+'-'+rtrim(company_phone)
from A,B
where 关联条件
这么我看不到星星?